ruvnet/ruflo · error · LLMProviderError
COHERE_${response.status}
COHERE_${response.status}
Error message
${message} What it means
CohereProvider's fallback mapping for any HTTP status other than 401/429: LLMProviderError with code COHERE_<status>, retryable=true only when status >= 500. The message is whatever Cohere's JSON error body contained ('Unknown error' if the body was not JSON).
Source
Thrown at v3/@claude-flow/providers/src/cohere-provider.ts:413
private async handleErrorResponse(response: Response): Promise<never> {
const errorText = await response.text();
let errorData: { message?: string };
try {
errorData = JSON.parse(errorText);
} catch {
errorData = { message: errorText };
}
const message = errorData.message || 'Unknown error';
switch (response.status) {
case 401:
throw new AuthenticationError(message, 'cohere', errorData);
case 429:
throw new RateLimitError(message, 'cohere', undefined, errorData);
default:
throw new LLMProviderError(
message,
`COHERE_${response.status}`,
'cohere',
response.status,
response.status >= 500,
errorData
);
}
}
}
View on GitHub (pinned to fa13ee4ad6)
Solutions
- Inspect error.statusCode and error.details (the parsed body) - the Cohere message names the actual problem
- For 4xx: fix the request (exact model id, supported parameters, payload size); retrying will not help
- For 5xx (retryable=true): retry with backoff or fail over to another provider via the ProviderManager
- If 5xx persists, check Cohere status and community channels for incidents
Example fix
// before
const res = await provider.complete(req); // COHERE_400 surfaces raw
// after - branch on retryability
try {
const res = await provider.complete(req);
} catch (e) {
if (e instanceof LLMProviderError && e.retryable) {
return retryWithBackoff(() => provider.complete(req));
}
throw e; // 4xx: fix the request instead of retrying
} Defensive patterns
Strategy: try-catch
Type guard
import { LLMProviderError, isLLMProviderError } from './types.js';
function isCohereApiError(e: unknown): e is LLMProviderError {
return isLLMProviderError(e) && e.provider === 'cohere' && e.code.startsWith('COHERE_');
} Try / catch
try {
return await provider.complete(req);
} catch (e) {
if (isCohereApiError(e)) {
if (e.retryable) return retryWithBackoff(() => provider.complete(req)); // 5xx only
throw new RequestError(`cohere rejected request (${e.statusCode}): ${e.message}`, { cause: e }); // 4xx: fix payload
}
throw e;
} Prevention
- Branch on error.retryable (true only for status >= 500) instead of retrying everything
- Log e.statusCode and e.details for 4xx - Cohere's message names the invalid field
- Validate model ids against provider.listModels() before sending
When it happens
Trigger: complete()/streamComplete() receiving a 400 (invalid request or bad model name), 404 (unknown model), or a 5xx from Cohere infrastructure.
Common situations: Unsupported parameter or oversized payload (400); model id typo like 'command-r' vs 'command-r-plus' (404); a Cohere-side incident returning 500/502/503.
Related errors
- GOOGLE_${response.status}
- OPENAI_${response.status}
- MCP server "${server.name}" is in cooldown (HTTP ${cd.status
- Web3.storage upload failed: ${response.status} ${error}
- Pinata upload failed: ${response.status} ${error}
AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18).
Data as JSON: /api/errors/76c4446e4ca9b744.
Report an issue: GitHub.