Mintplex-Labs/anything-llm · error · RetryError

error.message

Error message

error.message

What it means

Fireworks AI provider's `stream()` classifies OpenAI SDK errors. It logs `console.error(error.message, error)` first, then re-throws AuthenticationError, wraps RateLimitError/InternalServerError/APIError as `RetryError(error.message)`, and re-throws the rest. Fireworks model ids are long and namespaced (e.g. `accounts/fireworks/models/llama-v3p1-70b-instruct`), so a malformed id is a common APIError source.

Source

Thrown at server/utils/agents/aibitat/providers/fireworksai.js:97

    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;
    }
  }

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

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

    try {

View on GitHub (pinned to 526360e320)

Solutions

  1. Inspect the server console — the full error object is logged before rethrow.
  2. Treat RetryError as transient and let the framework retry.
  3. Verify FIREWORKS_API_KEY and the full model id (including the `accounts/fireworks/models/...` prefix).
  4. On repeated 429, raise the Fireworks tier or throttle the request rate.
  5. Check the Fireworks status page.
Defensive patterns

Strategy: retry

Validate before calling

// Validate the full namespaced Fireworks model id before streaming.
function assertFireworksModel(model) {
  if (!/^accounts\/[\w-]+\/models\/[\w.-]+$/.test(model))
    throw new Error(`Malformed Fireworks model id (expected accounts/<org>/models/<name>): ${model}`);
}

Type guard

function isRetryableProviderError(e) {
  return e instanceof OpenAI.RateLimitError || e instanceof OpenAI.InternalServerError || e instanceof OpenAI.APIError;
}

Try / catch

// Stream path logs via console.error. Retry on RetryError.
try { return await provider.stream(messages, functions, handler); }
catch (e) {
  if (e instanceof OpenAI.AuthenticationError) throw e;
  if (e instanceof RetryError) return await backoffAndRetry();
  throw e;
}

Prevention

When it happens

Trigger: Fireworks 429 (per-account RPM/TPM ceiling); 5xx platform incident; APIError from a malformed or unknown model id; stream interrupted mid-reply.

Common situations: FIREWORKS_API_KEY invalid or out of quota; model id truncated or missing the `accounts/fireworks/models/` prefix; peak-load throttling; Fireworks deploying a new model version.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/c383a25065c0a241. Report an issue: GitHub.