sipeed/picoclaw · error
empty LLM response
Error message
empty LLM response
What it means
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.
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
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at cmd/membench/llm_client.go:195 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/c24d7d514b2fe723.
Report an issue: GitHub.
Appendix: source
Thrown at cmd/membench/llm_client.go:195
var chatResp chatResponse
if err := json.Unmarshal(respBody, &chatResp); err != nil {
return "", fmt.Errorf("parse response: %w", err)
}
if len(chatResp.Choices) == 0 {
return "", fmt.Errorf("no choices in response")
}
content := strings.TrimSpace(chatResp.Choices[0].Message.Content)
// Strip any residual <think>...</think> blocks
if idx := strings.Index(content, "</think>"); idx >= 0 {
content = strings.TrimSpace(content[idx+len("</think>"):])
}
// Fallback: GLM/DeepSeek put thinking output in reasoning_content when thinking is enabled
if content == "" && chatResp.Choices[0].Message.ReasoningContent != "" {
content = strings.TrimSpace(chatResp.Choices[0].Message.ReasoningContent)
}
if content == "" {
return "", fmt.Errorf("empty LLM response")
}
return content, nil
}
View on GitHub (pinned to 49183d7e8d)