HKUDS/DeepTutor · error · GenerationFailure

interactive generation failed: {exc}

Error message

interactive generation failed: {exc}

What it means

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.

Source

Thrown at deeptutor/book/blocks/interactive.py:92

            pipeline = VisualizePipeline(
                api_key=primary_api_key(llm_config.api_key),
                base_url=llm_config.base_url,
                api_version=llm_config.api_version,
                language=ctx.language,
            )
            analysis = await pipeline.run_analysis(
                user_input=user_input,
                history_context=history_context,
                render_mode="html",
            )
            code = await pipeline.run_code_generation(
                user_input=user_input,
                history_context=history_context,
                analysis=analysis,
            )
        except Exception as exc:
            logger.warning(f"InteractiveGenerator failed: {exc}", exc_info=True)
            raise GenerationFailure(f"interactive generation failed: {exc}") from exc

        ok, validation_error = validate_visualization(code, "html")
        if not ok:
            raise GenerationFailure(f"interactive html failed validation: {validation_error}")

        return (
            {
                "render_type": "html",
                "code": {"language": "html", "content": code},
                "description": analysis.description,
                "chart_type": analysis.chart_type,
            },
            [],
            {
                "review_changed": False,
                "review_notes": "Passed local validation.",
            },
        )

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Inspect the logged warning traceback to identify the underlying exception
  2. Fix provider credentials / rate limits / context-size issues
  3. Retry the interactive generation turn
  4. Align the InteractiveGenerator version with the kwargs the block passes, or update the block
Defensive patterns

Strategy: try-catch

Validate before calling

assert llm_client_ready(), 'LLM provider unavailable before interactive generation'
assert len(history_context or '') < MAX_CTX, 'history too large'

Try / catch

try:
    payload = await interactive_block.generate(ctx)
except GenerationFailure as exc:
    logger.warning('interactive failed: %s', exc, exc_info=True)
    payload = fallback_static_html(ctx)

Prevention

When it happens

Trigger: 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.

Common situations: 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=...).

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/065ba84324e6388d. Report an issue: GitHub.