Skip to content

Missing telemetry API/provider causing misleading exception #3665

@onmete

Description

@onmete

🤔 What is the technical debt you think should be addressed?

Currently, if the telemetry API/provider is not defined in the run.yaml configuration, the llama-stack fails with an UnboundLocalError in agent_instance.py (turn_id variable not associated with a value). This failure path is misleading, as the root cause is simply that telemetry is required but not configured. The code does not provide a clear error message indicating that telemetry is mandatory, which makes debugging more difficult.

Error:

  File "<project-path>.venv/lib/python3.12/site-packages/llama_stack/providers/inline/agents/meta_reference/agent_instance.py", line 191, in create_and_execute_turn
    async for chunk in self._run_turn(request, turn_id):
                                               ^^^^^^^
UnboundLocalError: cannot access local variable 'turn_id' where it is not associated with a value

💡 What is the benefit of addressing this technical debt?

Improving error handling to explicitly indicate that telemetry is required would:

  • Prevent developer confusion when debugging missing configurations.
  • Reduce wasted time interpreting misleading stack traces.
  • Make the system's requirements clearer and easier to document.
  • Lay the groundwork for potentially making telemetry optional in the future, or at least providing graceful fallback behavior.

Other thoughts

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions