{"record":{"id":"24c1d10138609b2d","repo":"zylon-ai/private-gpt","slug":"no-summary-was-generated","errorCode":null,"errorMessage":"No summary was generated","messagePattern":"No summary was generated","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/workflows/others/summary.py","lineNumber":138,"sourceCode":"                )\n            )\n            result: SummarizeResultEvent = await handler\n\n            if output_cls:\n                response = result.output_obj\n                if not response:\n                    raise ValueError(\"No output object was generated\")\n                if not isinstance(response, BaseModel):\n                    raise TypeError(\n                        f\"Expected output object to be a BaseModel, got {type(response)}\"\n                    )\n                return [TextBlock(text=response.model_dump_json())]\n            else:\n                summary = result.summary\n                summary_text = summary if isinstance(summary, str) else None\n\n                if not summary_text:\n                    raise ValueError(\"No summary was generated\")\n\n                return [TextBlock(text=summary_text)]\n        except asyncio.CancelledError as e:\n            if handler:\n                await handler.cancel_run()\n            raise e\n\n    async def _generate_prompt_template(\n        self,\n        prompt: str | None = None,\n    ) -> BasePromptTemplate:\n        \"\"\"Define the prompt template for summarization.\"\"\"\n\n        def messages_gen() -> Iterator[ChatMessage]:\n            if prompt:\n                yield ChatMessage(\n                    content=prompt,\n                    role=MessageRole.SYSTEM,","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/workflows/others/summary.py#L120-L156","documentation":"Raised when run_summary was called WITHOUT output_cls and the finished SummarizeResultEvent carries no usable summary text (summary is None, empty, or not a str). The summarization completed but produced no prose — typically an empty LLM response after the fallback chain (response.response and empty_response_fallback both empty).","triggerScenarios":"Query engine returns Response with response=\"\" and no empty_response_fallback provided; LLM returns only whitespace/empty completion for the summary prompt; the workflow emitted a SummarizeResultEvent with only output_obj set while the caller asked for plain text.","commonSituations":"Summarizing an empty or irrelevant document set where the model answers nothing; overly strict token limits truncating output to empty; stop_condition_fn truncation paths; misconfigured prompts yielding empty 'Answer:' sections.","solutions":["Set empty_response_fallback (e.g. 'No content available to summarize') in run_summary so empty LLM responses degrade gracefully.","Inspect response.response from the query engine — if consistently empty, check retriever hit counts and prompt template context.","Raise max_output_tokens / check the token-limit configuration applied in execute_summarize.","If you actually wanted structured output, pass output_cls so the correct branch runs."],"exampleFix":"# before\nblocks = await wf.run_summary(prompt=p)\n\n# after\nblocks = await wf.run_summary(prompt=p, empty_response_fallback=\"No content available to summarize.\")","handlingStrategy":"fallback","validationCode":"blocks = await wf.run_summary(\n    prompt=p,\n    empty_response_fallback=\"No content available to summarize.\",\n)","typeGuard":"def has_summary(ev: SummarizeResultEvent) -> bool:\n    return isinstance(ev.summary, str) and ev.summary.strip() != \"\"","tryCatchPattern":"try:\n    blocks = await wf.run_summary(prompt=p)\nexcept ValueError as e:\n    if 'No summary was generated' in str(e):\n        blocks = [TextBlock(text='Summary unavailable.')]\n    else:\n        raise","preventionTips":["Always pass empty_response_fallback for user-facing summary endpoints","Monitor empty-response rates per model to catch prompt/token-budget regressions","Assert retrieved node count > 0 before invoking summarization"],"tags":["llm","empty-response","summarization","configuration"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}