Skip to content

US-3: Error Handling in JSON Mode #7

Description

@thm-design

US-3: Error Handling in JSON Mode

Parent Epic: #4 (Event Coverage & Error Handling)

As a pipeline consumer,
I want errors to be structured JSON events,
so that I can handle failures programmatically without parsing terminal logs.

Acceptance Criteria

  • Missing input produces {"type":"error","data":{"code":"NO_INPUT"}}
  • LLM API failures produce {"type":"error","data":{"code":"API_ERROR","message":"..."}}
  • Tool execution failures produce {"type":"error","data":{"code":"TOOL_ERROR","message":"...","tool":"read_file"}}
  • Error events are the last event emitted (or only event)
  • Exit code is non-zero when any error event is emitted
  • All errors include ISO timestamp

Technical Notes

  • Maps existing print() error handlers to structured JSON events
  • Error codes: NO_INPUT, API_ERROR, TOOL_ERROR (future: REPL_INCOMPATIBLE)
  • Detail field for additional context (stack trace, status code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    json-flagCortex --json flag featurestoryUser story with acceptance criteria

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions