cohere-common-errors
Diagnose and fix Cohere API v2 errors and exceptions. Use when encountering Cohere errors, debugging failed requests, or troubleshooting CohereError, CohereTimeoutError, rate limits. Trigger with phrases like "cohere error", "fix cohere", "cohere not working", "debug cohere", "cohere 429", "cohere 400".
What this skill does
# Cohere Common Errors
## Overview
Quick reference for real Cohere API v2 errors with exact messages, causes, and fixes.
## Prerequisites
- `cohere-ai` SDK installed
- `CO_API_KEY` configured
- Access to error logs
## Error Reference
### 400 — Bad Request: Missing Required Field
```
CohereError: model is required
```
**Cause:** API v2 requires `model` for all endpoints (Chat, Embed, Rerank, Classify).
**Fix:**
```typescript
// Wrong (v1 style)
await cohere.chat({ messages: [...] });
// Correct (v2)
await cohere.chat({ model: 'command-a-03-2025', messages: [...] });
```
---
### 400 — Embed: Missing embedding_types
```
CohereError: embedding_types is required for embed models v3 and higher
```
**Fix:**
```typescript
await cohere.embed({
model: 'embed-v4.0',
texts: ['hello'],
inputType: 'search_document',
embeddingTypes: ['float'], // Required for v3+
});
```
---
### 400 — Embed: Missing input_type
```
CohereError: input_type is required for embed models v3 and higher
```
**Fix:** Use one of: `search_document`, `search_query`, `classification`, `clustering`, `image`.
---
### 401 — Invalid API Token
```
CohereError: invalid api token
```
**Cause:** `CO_API_KEY` is missing, wrong, or revoked.
**Fix:**
```bash
# Verify key is set
echo $CO_API_KEY
# Test directly
curl -H "Authorization: Bearer $CO_API_KEY" \
https://api.cohere.com/v2/chat \
-H "Content-Type: application/json" \
-d '{"model":"command-r7b-12-2024","messages":[{"role":"user","content":"hi"}]}'
```
---
### 429 — Rate Limit Exceeded
```
CohereError: You are using a Trial key, which is limited to N calls/minute
```
**Rate limits by key type:**
| Key Type | Chat | Embed | Rerank | Other |
|----------|------|-------|--------|-------|
| Trial | 20/min | 5/min | 5/min | 1000/month |
| Production | 1000/min | 1000/min | 1000/min | Unlimited |
**Fix:**
```typescript
import { CohereError } from 'cohere-ai';
try {
await cohere.chat({ model: 'command-a-03-2025', messages: [...] });
} catch (err) {
if (err instanceof CohereError && err.statusCode === 429) {
// Back off and retry
await new Promise(r => setTimeout(r, 60_000)); // wait 60s for trial keys
// retry...
}
}
```
---
### 400 — Classify: Too Few Examples
```
CohereError: each unique label requires at least 2 examples
```
**Fix:**
```typescript
await cohere.classify({
model: 'embed-english-v3.0',
inputs: ['This product is amazing'],
examples: [
// Need at least 2 examples PER label
{ text: 'I love it', label: 'positive' },
{ text: 'Great product', label: 'positive' },
{ text: 'Terrible', label: 'negative' },
{ text: 'Worst ever', label: 'negative' },
],
});
```
---
### 400 — Rerank: Too Many Documents
```
CohereError: too many documents, max is 1000
```
**Fix:** Batch your documents:
```typescript
async function batchRerank(query: string, docs: string[], topN = 10) {
const BATCH = 1000;
let allResults: any[] = [];
for (let i = 0; i < docs.length; i += BATCH) {
const batch = docs.slice(i, i + BATCH);
const resp = await cohere.rerank({
model: 'rerank-v3.5',
query,
documents: batch,
topN,
});
allResults.push(
...resp.results.map(r => ({ ...r, index: r.index + i }))
);
}
return allResults.sort((a, b) => b.relevanceScore - a.relevanceScore).slice(0, topN);
}
```
---
### 400 — Chat: response_format with documents
```
CohereError: response_format is not supported with documents or tools
```
**Cause:** `response_format: { type: 'json_object' }` cannot be combined with `documents` or `tools`.
**Fix:** Use either JSON mode OR document/tool mode, not both. For structured RAG output, parse the text response yourself.
---
### 500/503 — Server Error
```
CohereError: internal server error
```
**Fix:** Retry with exponential backoff. If persistent, check [status.cohere.com](https://status.cohere.com).
---
### CohereTimeoutError
```
CohereTimeoutError: Request timed out
```
**Fix:** The SDK has a default timeout. Increase it or reduce payload:
```typescript
const cohere = new CohereClientV2({
token: process.env.CO_API_KEY,
timeoutInSeconds: 120, // default is lower
});
```
## Diagnostic Commands
```bash
# Check Cohere service status
curl -s https://status.cohere.com/api/v2/status.json | jq '.status'
# Verify API key works
curl -s -o /dev/null -w "%{http_code}" \
-H "Authorization: Bearer $CO_API_KEY" \
https://api.cohere.com/v2/chat \
-H "Content-Type: application/json" \
-d '{"model":"command-r7b-12-2024","messages":[{"role":"user","content":"ping"}]}'
# Check installed SDK version
npm list cohere-ai 2>/dev/null || pip show cohere 2>/dev/null
```
## Error Handling Wrapper
```typescript
import { CohereError, CohereTimeoutError } from 'cohere-ai';
function diagnoseCohereError(err: unknown): string {
if (err instanceof CohereTimeoutError) {
return 'TIMEOUT: Increase timeoutInSeconds or reduce input size';
}
if (err instanceof CohereError) {
switch (err.statusCode) {
case 400: return `BAD_REQUEST: ${err.message}`;
case 401: return 'AUTH: Check CO_API_KEY';
case 429: return 'RATE_LIMIT: Back off or upgrade key';
case 500: return 'SERVER: Retry later, check status.cohere.com';
default: return `UNKNOWN (${err.statusCode}): ${err.message}`;
}
}
return `UNEXPECTED: ${String(err)}`;
}
```
## Resources
- [Cohere Error Codes](https://docs.cohere.com/reference/errors)
- [Cohere Status Page](https://status.cohere.com)
- [Rate Limits](https://docs.cohere.com/docs/rate-limits)
- [API v1 to v2 Migration](https://docs.cohere.com/docs/migrating-v1-to-v2)
## Next Steps
For comprehensive debugging, see `cohere-debug-bundle`.
Related in Backend & APIs
jfrog
IncludedInteract with the JFrog Platform via the JFrog CLI and REST/GraphQL APIs. Use this skill when the user wants to manage Artifactory repositories, upload or download artifacts, manage builds, configure permissions, manage users and groups, work with access tokens, configure JFrog CLI servers, search artifacts, manage properties, set up replication, manage JFrog Projects, run security audits or scans, look up CVE details, query exposures scan results from JFrog Advanced Security, manage release bundles and lifecycle operations, aggregate or export platform data, or perform any JFrog Platform administration task. Also use when the user mentions jf, jfrog, artifactory, xray, distribution, evidence, apptrust, onemodel, graphql, workers, mission control, curation, advanced security, exposures, or any JFrog product name.
cupynumeric-migration-readiness
IncludedPre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment, scaling analysis, or refactor planning. Inspect the user's source code, look up NumPy usage, cross-reference the cuPyNumeric API support manifest, and distinguish distributed-scaling-friendly patterns from blockers such as unsupported APIs, scalar synchronization, host round-trips, Python/object-heavy control flow, shape/data-dependent branching, and in-place mutation hazards. Produce a verdict of READY, LIGHT REFACTOR, SIGNIFICANT REFACTOR, or NOT RECOMMENDED, with concrete refactor pointers.
alibabacloud-data-agent-skill
IncludedInvoke Alibaba Cloud Apsara Data Agent for Analytics via CLI to perform natural language-driven data analysis on enterprise databases. Data Agent for Analytics is an intelligent data analysis agent developed by Alibaba Cloud Database team for enterprise users. It automatically completes requirement analysis, data understanding, analysis insights, and report generation based on natural language descriptions. This tool supports: discovering data resources (instances/databases/tables) managed in DMS, initiating query or deep analysis sessions, real-time progress tracking, and retrieving analysis conclusions and generated reports. Use this Skill when users need to query databases, analyze data trends, generate data reports, ask questions in natural language, or mention "Data Agent", "data analysis", "database query", "SQL analysis", "data insights".
token-optimizer
IncludedReduce OpenClaw token usage and API costs through smart model routing, heartbeat optimization, budget tracking, and native 2026.2.15 features (session pruning, bootstrap size limits, cache TTL alignment). Use when token costs are high, API rate limits are being hit, or hosting multiple agents at scale. The 4 executable scripts (context_optimizer, model_router, heartbeat_optimizer, token_tracker) are local-only — no network requests, no subprocess calls, no system modifications. Reference files (PROVIDERS.md, config-patches.json) document optional multi-provider strategies that require external API keys and network access if you choose to use them. See SECURITY.md for full breakdown.
resend-cli
IncludedUse this skill when the task is specifically about operating Resend from an AI agent, terminal session, or CI job via the official resend CLI: installing/authenticating the CLI, sending/listing/updating/cancelling emails, batch sends, domains and DNS, webhooks and local listeners, inbound receiving, contacts, topics, segments, broadcasts, templates, API keys, profiles, or debugging Resend CLI/API failures. Trigger on mentions of Resend CLI, `resend`, `resend doctor`, `resend emails send`, `resend domains`, `resend webhooks listen`, `resend emails receiving`, or agent-friendly terminal automation.
alibabacloud-odps-maxframe-coding
IncludedUse this skill for MaxFrame SDK development and documentation navigation on Alibaba Cloud MaxCompute (ODPS). Helps answer MaxFrame API, concept, official example, and supported pandas API questions; create data processing programs; read/write MaxCompute tables; debug jobs (remote or local); and build custom DPE runtime images. Trigger when users mention MaxFrame, MaxCompute with MaxFrame, ODPS table processing, DPE runtime, MaxFrame docs/examples, DataFrame/Tensor operations, or GPU runtime setup. Works for both English and Chinese queries about Alibaba Cloud data processing with MaxFrame.