Mintplex-Labs/anything-llm · warning · Error
Cohere:getModelCapabilities - ${res.statusText}
Error message
Cohere:getModelCapabilities - ${res.statusText} What it means
Thrown when the raw GET to Cohere's native models endpoint (https://api.cohere.com/v1/models/{this.model}) returns a non-2xx HTTP status. The response.statusText (e.g. 'Not Found', 'Unauthorized') is embedded. This endpoint is separate from the OpenAI-compatible route and is used only to probe a model's feature set (tools, vision, reasoning). The surrounding try/catch logs the error and returns all-false capabilities.
Source
Thrown at server/utils/AiProviders/cohere/index.js:159
* Returns the capabilities of the model by querying Cohere's models endpoint.
* A model supports tool calling when its `features` array includes `tools` or `tool_choice`.
* The OpenAI-compatible route does not expose this, so we hit the native REST API.
* @returns {Promise<{tools: boolean, reasoning: boolean, imageGeneration: boolean, vision: boolean}>}
*/
async getModelCapabilities() {
try {
if (!process.env.COHERE_API_KEY)
throw new Error("No Cohere API key was set.");
const features = await fetch(
`https://api.cohere.com/v1/models/${this.model}`,
{
method: "GET",
headers: { Authorization: `Bearer ${process.env.COHERE_API_KEY}` },
}
)
.then((res) => {
if (!res.ok)
throw new Error(`Cohere:getModelCapabilities - ${res.statusText}`);
return res.json();
})
.then((data) => data?.features || []);
return {
tools: features.includes("tools"),
reasoning: features.includes("reasoning"),
imageGeneration: false,
vision: features.includes("vision"),
};
} catch (error) {
console.error("Cohere:getModelCapabilities", error.message);
return {
tools: false,
reasoning: false,
imageGeneration: false,
vision: false,
};View on GitHub (pinned to 526360e320)
Solutions
- Check server logs for the full 'Cohere:getModelCapabilities' console.error line — it prints the statusText which identifies the HTTP failure.
- Verify the model id against Cohere's native models list (GET https://api.cohere.com/v1/models) using the same API key.
- If the model is valid on the compatibility layer but not the native endpoint, the capabilities probe will always fail — the all-false fallback is acceptable and tool/vision features simply won't be advertised.
- For 401/403, rotate COHERE_API_KEY and confirm it has the required scopes.
Defensive patterns
Strategy: try-catch
Validate before calling
async function probeCohereModel(modelId, apiKey) {
const res = await fetch(`https://api.cohere.com/v1/models/${modelId}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
if (!res.ok) return null;
return res.json();
} Try / catch
// getModelCapabilities already has a try/catch (line 170) that logs and returns all-false. // No additional handling needed; capabilities gracefully degrade.
Prevention
- Verify the model id exists on Cohere's native /v1/models endpoint (not just the compatibility layer) before relying on capabilities.
- Treat capabilities as best-effort — the all-false fallback means tool/vision features are simply not advertised.
When it happens
Trigger: The model id in this.model does not exist in Cohere's native registry (404 Not Found); the bearer token is invalid or expired (401 Unauthorized); Cohere returns 429 rate-limit or 500/503 server error; the model id uses OpenAI-compatible naming that differs from the native API id.
Common situations: Setting COHERE_MODEL_PREF to a model alias that works on the compatibility layer but is not recognized by the native /v1/models endpoint; Cohere deprecating or renaming a model between config time and the capabilities probe; transient Cohere API outages.
Related errors
- Catalog request failed with status ${response.status}
- ${res.status} - ${res.statusText}. params: ${JSON.stringify(
- ${res.status} - ${res.statusText}. params: ${JSON.stringify(
- Failed to sync link content. ${reason}
- Failed to sync YouTube video transcript. ${reason}
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/53bf6afcbd20a1f0.
Report an issue: GitHub.