Mintplex-Labs/anything-llm · error · Error

SambaNova chat: No results!

Error message

SambaNova chat: No results!

What it means

In SambaNovaProvider.#handleFunctionCallChat (sambanova.js:33-45), the UnTooled chat path asserts the response has a `choices` property and throws "SambaNova chat: No results!" when it is absent. SambaNova occasionally returns an error/empty payload that the SDK surfaces as a fulfilled object lacking choices.

Source

Thrown at server/utils/agents/aibitat/providers/sambanova.js:41

  }

  get client() {
    return this._client;
  }

  get supportsAgentStreaming() {
    return true;
  }

  async #handleFunctionCallChat({ messages = [] }) {
    return await this.client.chat.completions
      .create({
        model: this.model,
        messages,
      })
      .then((result) => {
        if (!result.hasOwnProperty("choices"))
          throw new Error("SambaNova chat: No results!");
        if (result.choices.length === 0)
          throw new Error("SambaNova chat: No results length!");
        return result.choices[0].message.content;
      });
  }

  async #handleFunctionCallStream({ messages = [] }) {
    return await this.client.chat.completions.create({
      model: this.model,
      stream: true,
      messages,
    });
  }

  async stream(messages, functions = [], eventHandler = null) {
    const useNative = this.supportsNativeToolCalling();

    if (!useNative) {

View on GitHub (pinned to 526360e320)

Solutions

  1. Verify SAMBANOVA_LLM_API_KEY is valid and not expired.
  2. Confirm the model id is one SambaNova actually serves.
  3. Log the raw result object to see the actual envelope SambaNova returned.
  4. If the payload is a known error shape, surface it instead of the generic message.
  5. Retry once; transient malformed responses do occur.
Defensive patterns

Strategy: type-guard

Validate before calling

if (!process.env.SAMBANOVA_LLM_API_KEY)
  throw new Error("SAMBANOVA_LLM_API_KEY is not set.");

Type guard

/** @param {unknown} r
 * @returns {r is { choices: unknown[] }} */
function hasChoices(r) {
  return (
    !!r &&
    typeof r === "object" &&
    Array.isArray(/** @type {any} */ (r).choices)
  );
}

Try / catch

try {
  return await provider.complete(messages, functions);
} catch (e) {
  if (/SambaNova chat: No results/.test(e.message)) {
    // log the raw response and retry once; malformed envelopes are often transient
    await new Promise((r) => setTimeout(r, 1000));
    return await provider.complete(messages, functions);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the UnTooled (non-native) function-call chat path and SambaNova returns an object without a `choices` key, e.g. an error-shaped body, a model-not-found payload, or an empty {} from a gateway.

Common situations: Wrong or unsupported model id, an invalid/expired SAMBANOVA_LLM_API_KEY that SambaNova surfaces as a 200-with-error-body, or an upstream gateway returning a non-standard envelope.

Related errors


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