{"record":{"id":"3a18ccfe251cfed1","repo":"Mintplex-Labs/anything-llm","slug":"error-message-3a18cc","errorCode":null,"errorMessage":"error.message","messagePattern":"error\\.message","errorType":"exception","errorClass":"RetryError","httpStatus":null,"severity":"warning","filePath":"server/utils/agents/aibitat/providers/genericOpenAi.js","lineNumber":140,"sourceCode":"\n    try {\n      return await tooledStream(\n        this.client,\n        this.model,\n        messages,\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  /**\n   * Create a non-streaming completion with tool calling support.\n   * Uses native tool calling when supported, otherwise falls back to UnTooled.\n   */\n  async complete(messages, functions = []) {\n    const useNative = await this.supportsNativeToolCalling();\n\n    if (!useNative) {\n      return await UnTooled.prototype.complete.call(\n        this,\n        messages,\n        functions,\n        this.#handleFunctionCallChat.bind(this)","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/aibitat/providers/genericOpenAi.js#L122-L158","documentation":"GenericOpenAiProvider.stream() catch (genericOpenAi.js:132-143) rethrows RateLimitError/InternalServerError/APIError as RetryError(error.message), while AuthenticationError is rethrown verbatim. This provider targets any OpenAI-compatible endpoint configured via the generic-openai settings (GENERIC_OPEN_AI_BASE_PATH and friends).","triggerScenarios":"The configured third-party OpenAI-compatible endpoint returns 429, 5xx, or a non-auth APIError during a streaming tooled completion.","commonSituations":"GENERIC_OPEN_AI_BASE_PATH pointing at an unstable proxy, an upstream rate limit, an unsupported model id for that endpoint, or a request body the endpoint rejects.","solutions":["Verify GENERIC_OPEN_AI_BASE_PATH and the API key are correct and reachable.","Check the endpoint's own logs/status for the underlying 4xx/5xx.","Confirm the model id is one the endpoint actually serves.","Let the AIbitat retry loop handle transient failures; add backoff if 429s are frequent.","Reproduce the raw request with curl to see the exact upstream error."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Confirm the generic endpoint is reachable and the key is set before streaming.\nif (!process.env.GENERIC_OPEN_AI_BASE_PATH)\n  throw new Error(\"GENERIC_OPEN_AI_BASE_PATH is not set.\");\nconst u = new URL(process.env.GENERIC_OPEN_AI_BASE_PATH);\nconst probe = await fetch(`${u.origin}/models`, {\n  headers: process.env.GENERIC_OPEN_AI_API_KEY\n    ? { Authorization: `Bearer ${process.env.GENERIC_OPEN_AI_API_KEY}` }\n    : {},\n});\nif (!probe.ok) throw new Error(`Generic endpoint unreachable: ${probe.status}`);","typeGuard":null,"tryCatchPattern":"const { RetryError } = require(\"./server/utils/agents/aibitat/error.js\");\ntry {\n  return await provider.stream(messages, functions, handler);\n} catch (e) {\n  if (e instanceof RetryError && attempt < MAX) {\n    await new Promise((r) => setTimeout(r, 1000 * attempt));\n    return await provider.stream(messages, functions, handler);\n  }\n  throw e;\n}","preventionTips":["Probe the generic endpoint's /models at startup to fail fast on bad config.","Keep GENERIC_OPEN_AI_BASE_PATH and the key in sync across deploys.","Confirm the model id is one the endpoint serves before the first request.","Let RetryError propagate to the AIbitat loop for transient cases."],"tags":["generic-openai","retry","config","transient","openai-sdk"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}