Mintplex-Labs/anything-llm · error · RetryError

error.message

Error message

error.message

What it means

OMLXProvider.stream() catches failures from the streaming tool-call request (tooledStream) to the OMLX endpoint (parseOMLXBasePath(OMLX_LLM_BASE_PATH)) and rethrows OpenAI RateLimitError, InternalServerError, or any APIError as aibitat's RetryError with the original message; AuthenticationError is rethrown raw; unknown errors pass through. console.error logs the full raw error first, so the console is the best diagnostic source. As with all these providers, APIError is the SDK's base HTTP-error class, so a 404 for a wrong model id is wrapped identically to transient 429/5xx.

Source

Thrown at server/utils/agents/aibitat/providers/omlx.js:108

    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. Read the console log for the raw status: 429 -> back off, 5xx -> retry, 404/400 -> fix model or base path
  2. Confirm OMLX_LLM_MODEL_PREF matches an id the OMLX service actually serves
  3. Verify OMLX_LLM_BASE_PATH is the documented API root and the service is reachable
  4. Refresh OMLX_LLM_API_KEY if the endpoint enforces auth
Defensive patterns

Strategy: try-catch

Validate before calling

const base = parseOMLXBasePath(process.env.OMLX_LLM_BASE_PATH);
const res = await fetch(`${base}/models`, {
  headers: process.env.OMLX_LLM_API_KEY ? { Authorization: `Bearer ${process.env.OMLX_LLM_API_KEY}` } : {},
});
if (!res.ok) throw new Error(`OMLX pre-flight failed (${res.status}) — check OMLX_LLM_BASE_PATH`);

Type guard

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

Try / catch

try {
  return await provider.stream(messages, functions, eventHandler);
} catch (error) {
  if (error instanceof OpenAI.AuthenticationError) throw error;
  if (isTransientOmlx(error)) { await sleep(15_000); return provider.stream(messages, functions, eventHandler); }
  throw error; // 404/400: model id or base path wrong
}

Prevention

When it happens

Trigger: Streaming chat.completions.create against the OMLX base path returning 429 (service concurrency/rate cap), 5xx (model backend failure), 404/400 (model id from OMLX_LLM_MODEL_PREF not served), or auth misalignment where a non-401 rejection (e.g. 403) is wrapped.

Common situations: OMLX_LLM_BASE_PATH malformed (parseOMLXBasePath still builds a URL, but the wrong one 404s); OMLX_LLM_API_KEY stale so protected routes reject; shared OMLX endpoint saturated by other tenants; model id typo'd in env.

Related errors


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