Mintplex-Labs/anything-llm · error · Error

DeepSeek chat: is not valid for chat completion!

Error message

DeepSeek chat: ${this.model} is not valid for chat completion!

What it means

Pre-flight guard in DeepSeekLLM.getChatCompletion: the selected model failed the valid-model check against DeepSeek's model list, so the completion request is rejected before spending a call on a model DeepSeek does not serve.

Solutions

  1. Select a DeepSeek model valid for chat completion.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown when the configured DeepSeek model is not a chat model.

Common situations: Model preference set to an invalid or non-chat model.


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

Appendix: source

Thrown at server/utils/AiProviders/deepseek/index.js:99

  /**
   * Parses and prepends reasoning from the response and returns the full text response.
   * @param {Object} response
   * @returns {string}
   */
  #parseReasoningFromResponse({ message }) {
    let textResponse = message?.content;
    if (
      !!message?.reasoning_content &&
      message.reasoning_content.trim().length > 0
    )
      textResponse = `<think>${message.reasoning_content}</think>${textResponse}`;
    return textResponse;
  }

  async getChatCompletion(messages = null, { temperature = 0.7 }) {
    if (!(await this.isValidChatCompletionModel(this.model)))
      throw new Error(
        `DeepSeek chat: ${this.model} is not valid for chat completion!`
      );

    const result = await LLMPerformanceMonitor.measureAsyncFunction(
      this.openai.chat.completions
        .create({
          model: this.model,
          messages,
          temperature,
        })
        .catch((e) => {
          throw new Error(e.message);
        })
    );

    if (
      !result?.output?.hasOwnProperty("choices") ||
      result?.output?.choices?.length === 0

View on GitHub (pinned to 3aec848f28)