Skip to content

TUI sink discards actual error message in TurnFailed — user sees useless generic 'turn_failed (code=-32099)' #114

Description

@jonah791

Description

When a turn fails internally (e.g. LLM API error, missing dependency), the TUI only shows error: turn_failed (code=-32099) — a generic catch-all message that provides zero diagnostic value to the user.

The actual error (the exception message captured as TurnFailed.error) is silently discarded by the TUI sink before it reaches the user.

Root Cause

In raven/tui_rpc/spine.py, the _make_tui_sink function handles TurnFailed events like this:

if isinstance(event, TurnFailed):
    await _finish(event.conversation_id)
    _drop(event.conversation_id)
    if not event.cancelled:
        await outlet.emit_error(event.conversation_id, _TURN_FAILED_CODE, "turn_failed", "internal")

It hardcodes the message "turn_failed" and ignores event.error — which contains the actual exception string from the scheduler (str(exc) at raven/spine/scheduler.py:280). The user sees a useless generic error instead of the real problem.

Example

On a missing orjson dependency (issue #113), the user got:

error: turn_failed (code=-32099)

While the actual error logged (inaccessible to the user) was:

Error calling LLM: litellm.APIConnectionError: APIConnectionError:
OpenAIException - No module named 'orjson'

Had event.error been shown, the user could have fixed it without reading source code.

Suggested Fix

Replace the hardcoded string with the actual error:

if not event.cancelled:
    message = event.error or "turn_failed"
    await outlet.emit_error(event.conversation_id, _TURN_FAILED_CODE, message, "internal")

This way the user sees the real error, e.g. error: No module named 'orjson' (code=-32099).

Related

  • The TUI ErrorEvent payload schema already has a message field — it's just never filled with useful content.
  • The Gateway's GatewayTurnRunner may have a similar issue in its error path (not checked).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions