Mintplex-Labs/anything-llm · warning · Error

Cerebras:getModelCapabilities - ${res.statusText}

Error message

Cerebras:getModelCapabilities - ${res.statusText}

What it means

Thrown inside CerebrasLLM.getModelCapabilities when the per-model endpoint `https://api.cerebras.ai/public/v1/models/<this.model>` returns non-2xx; the .then checks res.ok and throws with statusText. The surrounding try returns a defaulted capabilities object on any failure, so the throw is internally swallowed — callers get `{tools|reasoning|vision: undefined}` rather than a propagated error.

Source

Thrown at server/utils/AiProviders/cerebras/index.js:272

    return handleDefaultStreamResponseV2(response, stream, responseProps);
  }

  /**
   * Returns the capabilities of the model.
   * This uses the new /public/v1/models endpoint, which returns the model capabilities.
   * @returns {Promise<{tools: 'unknown' | boolean, reasoning: 'unknown' | boolean, imageGeneration: 'unknown' | boolean, vision: 'unknown' | boolean}>}
   */
  async getModelCapabilities() {
    try {
      const capabilities =
        (await fetch(`https://api.cerebras.ai/public/v1/models/${this.model}`, {
          headers: {
            "Content-Type": "application/json",
          },
        })
          .then((res) => {
            if (!res.ok)
              throw new Error(
                `Cerebras:getModelCapabilities - ${res.statusText}`
              );
            return res.json();
          })
          .then(({ capabilities }) => capabilities)) || {};

      return {
        tools: capabilities?.tools,
        reasoning: capabilities?.reasoning,
        imageGeneration: false,
        vision: capabilities?.vision,
      };
    } catch (error) {
      console.error("Error getting model capabilities:", error);
      return {
        tools: "unknown",
        reasoning: "unknown",
        imageGeneration: "unknown",

View on GitHub (pinned to 526360e320)

Solutions

  1. Confirm the model id is correct and currently listed at https://api.cerebras.ai/public/v1/models.
  2. Treat as transient for outages — capabilities default to 'unknown'/undefined and the app continues; re-check later.
  3. Verify reachability: `curl -i https://api.cerebras.ai/public/v1/models/<model>`.
  4. If the path changed upstream, update the provider to the current Cerebras capabilities endpoint.

Example fix

// before
if (!res.ok)
  throw new Error(`Cerebras:getModelCapabilities - ${res.statusText}`);

// after - distinguish 404 (unknown model) from transient errors
if (!res.ok) {
  if (res.status === 404)
    throw new Error(`Cerebras:getModelCapabilities - unknown model ${this.model}`);
  throw new Error(`Cerebras:getModelCapabilities - ${res.status} ${res.statusText}`);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Optional pre-check that the model is publicly listed
async function cerebrasModelKnown(model) {
  const res = await fetch(`https://api.cerebras.ai/public/v1/models/${model}`, {
    signal: AbortSignal.timeout(5000),
  });
  return res.ok;
}

Type guard

/** @param {unknown} e @returns {boolean} */
function isCerebrasCapabilitiesError(e) {
  return e instanceof Error &&
    /Cerebras:getModelCapabilities/.test(e.message);
}

Try / catch

// getModelCapabilities swallows this internally and returns defaults.
const caps = await llm.getModelCapabilities();
if (caps.tools == null || caps.reasoning == null) {
  // Capability detection degraded; fall back to conservative behavior.
  disableToolCalling();
}

Prevention

When it happens

Trigger: Calling getModelCapabilities for a model id the public endpoint does not recognize (404), during a Cerebras outage (5xx), or when a proxy returns a non-2xx. The catch in getModelCapabilities returns a mostly-empty capabilities object, so feature detection silently degrades.

Common situations: this.model is a custom/new id not yet listed publicly; model id typo; transient outage; proxy block; the public capabilities path changed.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/41475beb69bf7862. Report an issue: GitHub.