Mintplex-Labs/anything-llm · error · Error
Ollama::getChatCompletion text response was empty.
Error message
Ollama::getChatCompletion text response was empty.
What it means
Response guard in OllamaAILLM.getChatCompletion: the call returned successfully but content was empty or zero-length, meaning Ollama produced no text (e.g. wrong endpoint response or empty generation) and there is nothing to return to the caller.
Solutions
- Retry the request.
- Check the Ollama model and prompt; the model may have produced no output.
- Review Ollama server logs.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown when Ollama returns an empty text response.
Common situations: Model produced no content or response parsing failed.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/7c04d00cd4455b93.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/AiProviders/ollama/index.js:305
return {
content,
usage: {
prompt_tokens: res.prompt_eval_count,
completion_tokens: res.eval_count,
total_tokens: res.prompt_eval_count + res.eval_count,
duration: res.eval_duration / 1e9,
},
};
})
.catch((e) => {
throw new Error(
`Ollama::getChatCompletion failed to communicate with Ollama. ${this.#errorHandler(e).message}`
);
})
);
if (!result.output.content || !result.output.content.length)
throw new Error(`Ollama::getChatCompletion text response was empty.`);
return {
textResponse: result.output.content,
metrics: {
prompt_tokens: result.output.usage.prompt_tokens,
completion_tokens: result.output.usage.completion_tokens,
total_tokens: result.output.usage.total_tokens,
outputTps:
result.output.usage.completion_tokens / result.output.usage.duration,
duration: result.output.usage.duration,
model: this.model,
provider: this.className,
timestamp: new Date(),
},
};
}
async streamGetChatCompletion(messages = null, { temperature = 0.7 }) {View on GitHub (pinned to 3aec848f28)