{"record":{"id":"7c04d00cd4455b93","repo":"Mintplex-Labs/anything-llm","slug":"ollama-getchatcompletion-text-response-was-empty","errorCode":null,"errorMessage":"Ollama::getChatCompletion text response was empty.","messagePattern":"Ollama::getChatCompletion text response was empty\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/AiProviders/ollama/index.js","lineNumber":305,"sourceCode":"          return {\n            content,\n            usage: {\n              prompt_tokens: res.prompt_eval_count,\n              completion_tokens: res.eval_count,\n              total_tokens: res.prompt_eval_count + res.eval_count,\n              duration: res.eval_duration / 1e9,\n            },\n          };\n        })\n        .catch((e) => {\n          throw new Error(\n            `Ollama::getChatCompletion failed to communicate with Ollama. ${this.#errorHandler(e).message}`\n          );\n        })\n    );\n\n    if (!result.output.content || !result.output.content.length)\n      throw new Error(`Ollama::getChatCompletion text response was empty.`);\n\n    return {\n      textResponse: result.output.content,\n      metrics: {\n        prompt_tokens: result.output.usage.prompt_tokens,\n        completion_tokens: result.output.usage.completion_tokens,\n        total_tokens: result.output.usage.total_tokens,\n        outputTps:\n          result.output.usage.completion_tokens / result.output.usage.duration,\n        duration: result.output.usage.duration,\n        model: this.model,\n        provider: this.className,\n        timestamp: new Date(),\n      },\n    };\n  }\n\n  async streamGetChatCompletion(messages = null, { temperature = 0.7 }) {","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/AiProviders/ollama/index.js#L287-L323","documentation":"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.","triggerScenarios":"Thrown when Ollama returns an empty text response.","commonSituations":"Model produced no content or response parsing failed.","solutions":["Retry the request.","Check the Ollama model and prompt; the model may have produced no output.","Review Ollama server logs."],"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"}