{"record":{"id":"065ba84324e6388d","repo":"HKUDS/DeepTutor","slug":"interactive-generation-failed-exc","errorCode":null,"errorMessage":"interactive generation failed: {exc}","messagePattern":"interactive generation failed: (.+?)","errorType":"exception","errorClass":"GenerationFailure","httpStatus":null,"severity":"error","filePath":"deeptutor/book/blocks/interactive.py","lineNumber":92,"sourceCode":"            pipeline = VisualizePipeline(\n                api_key=primary_api_key(llm_config.api_key),\n                base_url=llm_config.base_url,\n                api_version=llm_config.api_version,\n                language=ctx.language,\n            )\n            analysis = await pipeline.run_analysis(\n                user_input=user_input,\n                history_context=history_context,\n                render_mode=\"html\",\n            )\n            code = await pipeline.run_code_generation(\n                user_input=user_input,\n                history_context=history_context,\n                analysis=analysis,\n            )\n        except Exception as exc:\n            logger.warning(f\"InteractiveGenerator failed: {exc}\", exc_info=True)\n            raise GenerationFailure(f\"interactive generation failed: {exc}\") from exc\n\n        ok, validation_error = validate_visualization(code, \"html\")\n        if not ok:\n            raise GenerationFailure(f\"interactive html failed validation: {validation_error}\")\n\n        return (\n            {\n                \"render_type\": \"html\",\n                \"code\": {\"language\": \"html\", \"content\": code},\n                \"description\": analysis.description,\n                \"chart_type\": analysis.chart_type,\n            },\n            [],\n            {\n                \"review_changed\": False,\n                \"review_notes\": \"Passed local validation.\",\n            },\n        )","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/book/blocks/interactive.py#L74-L110","documentation":"The interactive block wraps the InteractiveGenerator call in try/except; any exception from it (LLM errors, parsing failures, internal errors) is re-raised as GenerationFailure('interactive generation failed: ...') with the cause chained and a warning traceback logged.","triggerScenarios":"Calling interactive _generate when InteractiveGenerator throws — LLM provider failure (auth, rate limit, timeout), unparseable analysis/code output, or an internal exception in the generator given the supplied user_input/history_context/analysis.","commonSituations":"Missing or invalid LLM API credentials; rate limiting during long interactive sessions; history_context too large blowing the context window; generator package version whose API no longer matches the kwargs passed (analysis=..., history_context=...).","solutions":["Inspect the logged warning traceback to identify the underlying exception","Fix provider credentials / rate limits / context-size issues","Retry the interactive generation turn","Align the InteractiveGenerator version with the kwargs the block passes, or update the block"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"assert llm_client_ready(), 'LLM provider unavailable before interactive generation'\nassert len(history_context or '') < MAX_CTX, 'history too large'","typeGuard":null,"tryCatchPattern":"try:\n    payload = await interactive_block.generate(ctx)\nexcept GenerationFailure as exc:\n    logger.warning('interactive failed: %s', exc, exc_info=True)\n    payload = fallback_static_html(ctx)","preventionTips":["Check provider credentials and quota before generation","Trim history_context to stay inside the model context window","Pin the InteractiveGenerator version to match the block's kwargs"],"tags":["interactive","llm-pipeline","wrapper-exception","generation"],"backgroundTag":"llm-generation-pipeline-failure","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}