Mintplex-Labs/anything-llm · error · RetryError

error.message

Error message

error.message

What it means

DeepSeek 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. DeepSeek is reached via its OpenAI-compatible API; deepseek-chat and deepseek-reasoner are the typical slugs.

Source

Thrown at server/utils/agents/aibitat/providers/deepseek.js:156

    try {
      return await tooledStream(
        this.client,
        this.model,
        cleanedMessages,
        functions,
        eventHandler,
        this.#tooledOptions
      );
    } 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 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 with backoff.
  3. If repeatedly 429 on reasoner, fall back to deepseek-chat (lighter throttle) or off-peak timing.
  4. Confirm DEEPSEEK_API_KEY is valid and the model slug is current.
  5. Check DeepSeek status/announcements for ongoing incidents.
Defensive patterns

Strategy: retry

Validate before calling

// Pick the lighter-throttled model when reasoner is rate-limited.
function pickDeepSeekModel(preferred) {
  return preferred === 'deepseek-reasoner' ? 'deepseek-reasoner' : 'deepseek-chat';
}

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 with backoff; consider model fallback on repeated 429.
try { return await provider.stream(messages, functions, handler); }
catch (e) {
  if (e instanceof OpenAI.AuthenticationError) throw e;
  if (e instanceof RetryError) return await backoffAndRetry({ fallbackModel: 'deepseek-chat' });
  throw e;
}

Prevention

When it happens

Trigger: DeepSeek 429 (free/reasoner tier throttling during peak CN-business-hours load — very common); DeepSeek 5xx under platform load; APIError from an unknown or retired model slug; stream interrupted mid-reply.

Common situations: Free-tier DEEPSEEK_API_KEY exhausted during peak; deepseek-reasoner rate-limited more aggressively than deepseek-chat; model slug typo; DeepSeek platform incident.

Related errors


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