{"record":{"id":"91b206bce269ceb7","repo":"zylon-ai/private-gpt","slug":"no-response-was-generated","errorCode":null,"errorMessage":"No response was generated","messagePattern":"No response was generated","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/workflows/others/summary.py","lineNumber":226,"sourceCode":"            user_query=ev.instructions,\n            additional_instructions=\"\\n\".join(ev.additional_instructions or []),\n            max_words=int(max_tokens * 0.75),\n        )\n\n        logger.debug(f\"Executing summarization with max_tokens: {max_tokens}\")\n        task = asyncio.create_task(query_engine.aquery(template.format()))\n        try:\n            response = await task\n        except asyncio.CancelledError:\n            logger.info(\"Summarization task was cancelled\")\n            task.cancel()\n            raise\n\n        logger.debug(\"Summarization completed successfully\")\n\n        if ev.output_cls and isinstance(response, PydanticResponse):\n            if not response.response:\n                raise ValueError(\"No response was generated\")\n\n            return SummarizeResultEvent(\n                output_obj=response.response,\n            )\n\n        if isinstance(response, Response):\n            summary = response.response or ev.empty_response_fallback or \"\"\n            if not summary:\n                raise ValueError(\"No summary was generated\")\n\n            sanitized = MarkdownHelper.sanitize_markdown(summary)\n            return SummarizeResultEvent(summary=sanitized or summary)\n\n        elif isinstance(response, StreamingResponse):\n            raise NotImplementedError(\n                \"Streaming responses are not yet implemented for summarization\"\n            )\n","sourceCodeStart":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/workflows/others/summary.py#L208-L244","documentation":"Inside the workflow step execute_summarize: the query engine returned a PydanticResponse (because output_cls was set) but its .response payload is falsy — the structured-output model instance is None/empty. The step refuses to emit SummarizeResultEvent(output_obj=...) with nothing in it, surfacing the failure early instead of at the caller.","triggerScenarios":"Query engine configured with response_mode producing PydanticResponse but the LLM output failed schema parsing, yielding an empty structured object; output_cls registered on the engine while the model returned empty content; edge case where synthesize() constructs an empty PydanticResponse.","commonSituations":"Structured summarization with a schema the model cannot satisfy; empty retrieval context producing empty generations; llama-index version changes in how failed structured parses are represented.","solutions":["Log the raw LLM output for the summary prompt and compare against output_cls — loosen the schema (make fields optional with defaults) if parsing fails.","Verify the retriever actually returns nodes (the same message hints 'Ensure the retriever returns nodes') and that context reaches the prompt.","Upgrade/align llama-index so PydanticResponse.response is reliably populated on successful parses.","Retry with a more explicit instruction to output JSON conforming to the schema."],"exampleFix":"# before\nclass Summary(BaseModel):\n    title: str\n    bullets: list[str]\n\n# after\nclass Summary(BaseModel):\n    title: str = \"\"\n    bullets: list[str] = Field(default_factory=list)","handlingStrategy":"fallback","validationCode":"if ev.output_cls and isinstance(response, PydanticResponse) and not response.response:\n    return SummarizeResultEvent(summary=ev.empty_response_fallback or \"\")","typeGuard":"def valid_pydantic_response(r: object) -> bool:\n    return isinstance(r, PydanticResponse) and r.response is not None","tryCatchPattern":"try:\n    result = await handler\nexcept ValueError as e:\n    if 'No response was generated' in str(e):\n        result = await retry_with_looser_schema()","preventionTips":["Make output_cls fields optional with defaults so parses rarely yield empty objects","Validate output_cls against sample model outputs in CI","Check source_nodes before requesting structured output"],"tags":["structured-output","llm","pydantic","empty-response"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}