{"record":{"id":"c24d7d514b2fe723","repo":"sipeed/picoclaw","slug":"empty-llm-response","errorCode":null,"errorMessage":"empty LLM response","messagePattern":"empty LLM response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/membench/llm_client.go","lineNumber":195,"sourceCode":"\n\tvar chatResp chatResponse\n\tif err := json.Unmarshal(respBody, &chatResp); err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse response: %w\", err)\n\t}\n\tif len(chatResp.Choices) == 0 {\n\t\treturn \"\", fmt.Errorf(\"no choices in response\")\n\t}\n\tcontent := strings.TrimSpace(chatResp.Choices[0].Message.Content)\n\t// Strip any residual <think>...</think> blocks\n\tif idx := strings.Index(content, \"</think>\"); idx >= 0 {\n\t\tcontent = strings.TrimSpace(content[idx+len(\"</think>\"):])\n\t}\n\t// Fallback: GLM/DeepSeek put thinking output in reasoning_content when thinking is enabled\n\tif content == \"\" && chatResp.Choices[0].Message.ReasoningContent != \"\" {\n\t\tcontent = strings.TrimSpace(chatResp.Choices[0].Message.ReasoningContent)\n\t}\n\tif content == \"\" {\n\t\treturn \"\", fmt.Errorf(\"empty LLM response\")\n\t}\n\treturn content, nil\n}\n","sourceCodeStart":177,"sourceCodeEnd":199,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/membench/llm_client.go#L177-L199","documentation":"Raised in Complete after a successful HTTP exchange when the trimmed message content from the LLM's first choice is empty and no reasoning_content fallback yields text: the model returned a structurally valid chat completion whose answer body is blank (e.g. all output confined to think tags or reasoning_content that was also empty), so there is no usable answer to return.","triggerScenarios":"Thrown at cmd/membench/llm_client.go:195 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the request: empty completions from GLM/DeepSeek-class models are often transient; one retry with the same prompt usually produces content","Verify the model and endpoint configuration (MEMBENCH_MODEL, MEMBENCH_API_BASE) — a misrouted model can return empty choices/content","If reasoning_content is populated, extract the answer from it instead of failing on empty content","Add a small max-tokens floor; completions truncated at zero output tokens produce empty content"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}