{"record":{"id":"ec52a5ea6dcc7941","repo":"HKUDS/DeepTutor","slug":"llm-returned-no-deep-dive-suggestions","errorCode":null,"errorMessage":"LLM returned no deep-dive suggestions.","messagePattern":"LLM returned no deep-dive suggestions\\.","errorType":"exception","errorClass":"GenerationFailure","httpStatus":null,"severity":"error","filePath":"deeptutor/book/blocks/deep_dive.py","lineNumber":61,"sourceCode":"            expected_key=\"suggestions\",\n        )\n        suggestions_raw = data.get(\"suggestions\") if isinstance(data, dict) else None\n        suggestions: list[dict[str, str]] = []\n        if isinstance(suggestions_raw, list):\n            for item in suggestions_raw[:5]:\n                if not isinstance(item, dict):\n                    continue\n                topic = str(item.get(\"topic\") or \"\").strip()\n                if not topic:\n                    continue\n                suggestions.append(\n                    {\n                        \"topic\": topic[:160],\n                        \"rationale\": str(item.get(\"rationale\") or \"\").strip()[:300],\n                    }\n                )\n        if not suggestions:\n            raise GenerationFailure(\"LLM returned no deep-dive suggestions.\")\n        return (\n            {\"suggestions\": suggestions},\n            [],\n            data.get(\"_metadata\") if isinstance(data.get(\"_metadata\"), dict) else {},\n        )\n\n\n__all__ = [\"DeepDiveGenerator\"]\n","sourceCodeStart":43,"sourceCodeEnd":70,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/book/blocks/deep_dive.py#L43-L70","documentation":"The deep_dive block asks the LLM for a list of deep-dive topic suggestions; after filtering/parsing, zero valid suggestions remain, so GenerationFailure is raised. It means the LLM response either contained no items, or every item failed the minimal extraction (e.g. missing/blank topic).","triggerScenarios":"Calling deep_dive _generate when the LLM returns an empty suggestions list, a malformed payload whose items all lack a usable 'topic' field, or when topics are blank after strip(). Any of these leaves the suggestions list empty at the guard.","commonSituations":"LLM refuses or returns a refusal/clarification instead of JSON; JSON parsing produced an empty list silently; over-aggressive item filtering (topic[:160] on empty strings); prompt/schema drift after a model or prompt-template change.","solutions":["Retry the generation — transient empty LLM responses often succeed on retry","Inspect the raw LLM payload logging to confirm whether 'suggestions' was empty or items were dropped by parsing","Tighten the prompt (explicit JSON schema, minimum N suggestions) or lower temperature so the model doesn't return refusals","If parsing drops items, relax the extraction so items with any non-empty topic survive"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(2):\n    try:\n        return await deep_dive_block.generate(ctx)\n    except GenerationFailure as exc:\n        if 'no deep-dive suggestions' in str(exc) and attempt == 0:\n            continue\n        raise","preventionTips":["Prompt for a minimum number of suggestions with an explicit JSON schema","Enable structured/JSON output mode on the model","Log raw LLM payloads when empty results occur to spot prompt drift"],"tags":["deep-dive","llm-output","empty-response","generation"],"backgroundTag":"llm-empty-response","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}