{"record":{"id":"cd8ce71f53183558","repo":"Mintplex-Labs/anything-llm","slug":"deepseek-chat-this-model-is-not-valid-for-chat","errorCode":null,"errorMessage":"DeepSeek chat: ${this.model} is not valid for chat completion!","messagePattern":"DeepSeek chat: (.+?) is not valid for chat completion!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/deepseek/index.js","lineNumber":99,"sourceCode":"\n  /**\n   * Parses and prepends reasoning from the response and returns the full text response.\n   * @param {Object} response\n   * @returns {string}\n   */\n  #parseReasoningFromResponse({ message }) {\n    let textResponse = message?.content;\n    if (\n      !!message?.reasoning_content &&\n      message.reasoning_content.trim().length > 0\n    )\n      textResponse = `<think>${message.reasoning_content}</think>${textResponse}`;\n    return textResponse;\n  }\n\n  async getChatCompletion(messages = null, { temperature = 0.7 }) {\n    if (!(await this.isValidChatCompletionModel(this.model)))\n      throw new Error(\n        `DeepSeek chat: ${this.model} is not valid for chat completion!`\n      );\n\n    const result = await LLMPerformanceMonitor.measureAsyncFunction(\n      this.openai.chat.completions\n        .create({\n          model: this.model,\n          messages,\n          temperature,\n        })\n        .catch((e) => {\n          throw new Error(e.message);\n        })\n    );\n\n    if (\n      !result?.output?.hasOwnProperty(\"choices\") ||\n      result?.output?.choices?.length === 0","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/AiProviders/deepseek/index.js#L81-L117","documentation":"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.","triggerScenarios":"Thrown when the configured DeepSeek model is not a chat model.","commonSituations":"Model preference set to an invalid or non-chat model.","solutions":["Select a DeepSeek model valid for chat completion."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}