Mintplex-Labs/anything-llm · error · RetryError

${error.message}

Error message

${error.message}

What it means

MinimaxProvider.stream() catches failures from the streaming tool-call request to https://api.minimax.io/v1 and rethrows OpenAI RateLimitError, InternalServerError, or any APIError as RetryError(error.message); AuthenticationError is rethrown unwrapped; everything else passes through. The raw error is logged with console.error first, so the console holds the full object. Note the provider strips attachments before sending (MiniMax models reject image inputs), so vision payloads should not be the cause — model id, quota, and service-side failures are.

Source

Thrown at server/utils/agents/aibitat/providers/minimax.js:128

    try {
      return await tooledStream(
        this.client,
        this.model,
        cleanedMessages,
        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;
    }
  }

  async complete(messages, functions = []) {
    const useNative = this.supportsNativeToolCalling();
    const cleanedMessages = this.#stripAttachments(messages);

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

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Check the console log for the raw error and its HTTP status: 429 -> slow down / upgrade quota, 5xx -> retry later, 4xx -> fix key or model id
  2. Confirm MINIMAX_API_KEY is valid and has quota (test with a direct curl to https://api.minimax.io/v1/chat/completions)
  3. Set an explicit current model id in the agent config instead of relying on the compiled-in default
  4. For 429s, reduce agent parallelism or add spacing between tool-call rounds, then re-run

Example fix

# before
MINIMAX_API_KEY=expired-key   # 403 -> APIError -> RetryError on every call

# after
MINIMAX_API_KEY=<valid key>
# agent config
new MinimaxProvider({ model: "MiniMax-M2.7" })
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-flight the MiniMax key
if (!process.env.MINIMAX_API_KEY) throw new Error("MINIMAX_API_KEY not set");
const res = await fetch("https://api.minimax.io/v1/models", {
  headers: { Authorization: `Bearer ${process.env.MINIMAX_API_KEY}` },
});
if (!res.ok) throw new Error(`MiniMax pre-flight failed (${res.status})`);

Type guard

const { RetryError } = require("./server/utils/agents/aibitat/error.js");
const isRetryError = (e) => e instanceof RetryError;
const isRateLimited = (e) => isRetryError(e) && /429|rate/i.test(String(e.message));

Try / catch

try {
  return await provider.stream(messages, functions, eventHandler);
} catch (error) {
  if (error instanceof OpenAI.AuthenticationError) throw error;
  if (isRateLimited(error)) { await sleep(20_000); return provider.stream(messages, functions, eventHandler); }
  throw error;
}

Prevention

When it happens

Trigger: Streaming chat.completions.create with apiKey MINIMAX_API_KEY returning 429 (Minimax rate/QPS or quota limit), 5xx on the Minimax side, 404/400 when this.model (default "MiniMax-M2.7") is not a valid id for the account or region, or 403-style rejections that APIError wraps when the key has no access to the requested model.

Common situations: Free-tier key hitting QPS limits during agent tool loops; model id drifted after a MiniMax release renamed models while the stored default stayed; key created for a different Minimax product/environment than api.minimax.io; intermittent 5xx during provider incidents.

Related errors


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