Mintplex-Labs/anything-llm · error · RetryError

error.message

Error message

error.message

What it means

NovitaProvider.stream() catches failures from the streaming tool-call request to https://api.novita.ai/v3/openpi and rethrows OpenAI RateLimitError, InternalServerError, or any APIError as aibitat's RetryError with the original message; AuthenticationError (bad NOVITA_LLM_API_KEY) is rethrown unwrapped; other errors pass through. The raw error object is logged via console.error before the wrap, so the server console shows the true cause. Because APIError covers all HTTP status errors, a 404 for an invalid model slug (default "deepseek/deepseek-r1") is wrapped just like a transient 429/5xx.

Source

Thrown at server/utils/agents/aibitat/providers/novita.js:126

    try {
      return await tooledStream(
        this.client,
        this.model,
        messages,
        functions,
        eventHandler,
        { provider: this }
      );
    } catch (error) {
      console.error(error.message, error);
      if (error instanceof OpenAI.AuthenticationError) throw error;
      if (
        error instanceof OpenAI.RateLimitError ||
        error instanceof OpenAI.InternalServerError ||
        error instanceof OpenAI.APIError
      ) {
        throw new RetryError(error.message);
      }
      throw error;
    }
  }

  /**
   * Create a non-streaming completion with tool calling support.
   * Uses native tool calling when supported, otherwise falls back to UnTooled.
   */
  async complete(messages, functions = []) {
    const useNative = await this.supportsNativeToolCalling();

    if (!useNative) {
      return await UnTooled.prototype.complete.call(
        this,
        messages,
        functions,
        this.#handleFunctionCallChat.bind(this)

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Check the console log for the raw error/status: 429 -> back off, 5xx -> retry later, 404/400 -> fix the model slug
  2. Verify the exact slug in the Novita model catalog and set it in config.model or the stored provider setting (format vendor/model-name)
  3. Confirm NOVITA_LLM_API_KEY is active and the account has balance
  4. For 429s, reduce concurrent agent sessions or queue tool-call rounds

Example fix

// before
new NovitaProvider({ model: "deepseek-r1" }); // missing owner prefix -> 404 -> RetryError

// after
new NovitaProvider({ model: "deepseek/deepseek-r1" }); // valid Novita slug
Defensive patterns

Strategy: try-catch

Validate before calling

const models = await fetch("https://api.novita.ai/v3/openai/models", {
  headers: { Authorization: `Bearer ${process.env.NOVITA_LLM_API_KEY}` },
}).then(r => r.json());
if (!models.data?.some((m) => m.id === provider.model)) throw new Error(`'${provider.model}' is not a Novita slug (expected vendor/model)`);

Type guard

const { RetryError } = require("./server/utils/agents/aibitat/error.js");
const isRetryError = (e) => e instanceof RetryError;
const isInvalidSlug = (e) => isRetryError(e) && /40[04]/.test(String(e.message));

Try / catch

try {
  return await provider.stream(messages, functions, eventHandler);
} catch (error) {
  if (error instanceof OpenAI.AuthenticationError) throw error;
  if (isInvalidSlug(error)) throw new Error("Fix the Novita model slug — retrying will not help");
  if (error instanceof RetryError) return withBackoff(() => provider.stream(messages, functions, eventHandler));
  throw error;
}

Prevention

When it happens

Trigger: Streaming chat.completions.create with apiKey NOVITA_LLM_API_KEY returning 429 (Novita rate/concurrency limits), 5xx upstream model failures, 404/400 when this.model is not a valid Novita model slug (wrong owner-prefix or typo), or balance/permission rejections that surface as 4xx APIErrors.

Common situations: Model slug format drift — Novita ids are owner/model and a bare name 404s; account out of credit so requests get rejected; free-tier concurrency cap hit by parallel agent chats; Novita incident returning 5xx across models.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/f158cdb21bafdaac. Report an issue: GitHub.