{"record":{"id":"f2b9285c24dfdaf5","repo":"Mintplex-Labs/anything-llm","slug":"invalid-response-body-returned-from-deepseek-js","errorCode":null,"errorMessage":"Invalid response body returned from DeepSeek: ${JSON.stringify(result.output)}","messagePattern":"Invalid response body returned from DeepSeek: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/deepseek/index.js","lineNumber":119,"sourceCode":"      );\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\n    )\n      throw new Error(\n        `Invalid response body returned from DeepSeek: ${JSON.stringify(result.output)}`\n      );\n\n    return {\n      textResponse: this.#parseReasoningFromResponse(result.output.choices[0]),\n      metrics: {\n        prompt_tokens: result.output.usage.prompt_tokens || 0,\n        completion_tokens: result.output.usage.completion_tokens || 0,\n        total_tokens: result.output.usage.total_tokens || 0,\n        outputTps: result.output.usage.completion_tokens / result.duration,\n        duration: result.duration,\n        model: this.model,\n        provider: this.className,\n        timestamp: new Date(),\n      },\n    };\n  }\n","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/AiProviders/deepseek/index.js#L101-L137","documentation":"Response-shape guard in DeepSeekLLM.getChatCompletion: the API call succeeded but the payload lacked a non-empty choices array, meaning DeepSeek returned a malformed, empty, or error-shaped body that cannot yield a chat text response; the raw body is serialized for diagnosis.","triggerScenarios":"Thrown when DeepSeek returns an unexpected response body.","commonSituations":"API changed response shape or returned an error object.","solutions":["Check the DeepSeek response for error details.","Verify the request parameters match the DeepSeek API.","Retry the request."],"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"}