{"record":{"id":"13ef8b4c435be760","repo":"Mintplex-Labs/anything-llm","slug":"error-message-13ef8b","errorCode":null,"errorMessage":"${error.message}","messagePattern":"\\$\\{error\\.message\\}","errorType":"exception","errorClass":"RetryError","httpStatus":null,"severity":"error","filePath":"server/utils/agents/aibitat/providers/minimax.js","lineNumber":128,"sourceCode":"\n    try {\n      return await tooledStream(\n        this.client,\n        this.model,\n        cleanedMessages,\n        functions,\n        eventHandler,\n        { provider: this }\n      );\n    } catch (error) {\n      console.error(error.message, error);\n      if (error instanceof OpenAI.AuthenticationError) throw error;\n      if (\n        error instanceof OpenAI.RateLimitError ||\n        error instanceof OpenAI.InternalServerError ||\n        error instanceof OpenAI.APIError\n      ) {\n        throw new RetryError(error.message);\n      }\n      throw error;\n    }\n  }\n\n  async complete(messages, functions = []) {\n    const useNative = this.supportsNativeToolCalling();\n    const cleanedMessages = this.#stripAttachments(messages);\n\n    if (!useNative) {\n      return await UnTooled.prototype.complete.call(\n        this,\n        cleanedMessages,\n        functions,\n        this.#handleFunctionCallChat.bind(this)\n      );\n    }\n","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/agents/aibitat/providers/minimax.js#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","Confirm MINIMAX_API_KEY is valid and has quota (test with a direct curl to https://api.minimax.io/v1/chat/completions)","Set an explicit current model id in the agent config instead of relying on the compiled-in default","For 429s, reduce agent parallelism or add spacing between tool-call rounds, then re-run"],"exampleFix":"# before\nMINIMAX_API_KEY=expired-key   # 403 -> APIError -> RetryError on every call\n\n# after\nMINIMAX_API_KEY=<valid key>\n# agent config\nnew MinimaxProvider({ model: \"MiniMax-M2.7\" })","handlingStrategy":"try-catch","validationCode":"// Pre-flight the MiniMax key\nif (!process.env.MINIMAX_API_KEY) throw new Error(\"MINIMAX_API_KEY not set\");\nconst res = await fetch(\"https://api.minimax.io/v1/models\", {\n  headers: { Authorization: `Bearer ${process.env.MINIMAX_API_KEY}` },\n});\nif (!res.ok) throw new Error(`MiniMax pre-flight failed (${res.status})`);","typeGuard":"const { RetryError } = require(\"./server/utils/agents/aibitat/error.js\");\nconst isRetryError = (e) => e instanceof RetryError;\nconst isRateLimited = (e) => isRetryError(e) && /429|rate/i.test(String(e.message));","tryCatchPattern":"try {\n  return await provider.stream(messages, functions, eventHandler);\n} catch (error) {\n  if (error instanceof OpenAI.AuthenticationError) throw error;\n  if (isRateLimited(error)) { await sleep(20_000); return provider.stream(messages, functions, eventHandler); }\n  throw error;\n}","preventionTips":["Pin the model id in agent config and refresh it when MiniMax ships new model names","Throttle tool-call rounds to respect QPS limits instead of bursting","Check the console log — this site prints the raw error","Keep attachments out of MiniMax chats (the provider already strips them; don't reintroduce them via custom code)"],"tags":["llm-provider","minimax","openai-sdk","retry-error","rate-limit","streaming"],"backgroundTag":"openai-api-error","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}