Skip to content

Inconsistent session-not-found error envelope: pause_execution and list_threads throw McpError while sibling tools return structured success:false #203

Description

@debugmcpdev

Found by an osoji audit panel review (two independent adjudications agreeing, at commit 2f2782c).

Behavior

For the identical condition — a request carrying an unknown/stale sessionId — tools diverge in error envelope:

  • pause_execution: handlePause (src/server.ts ~L1278-1293) re-throws validateSession's plain McpError (~L276, ~L1285) → protocol-level error.
  • list_threads: handleListThreads (~L1295-1305) re-throws the same way (~L1302).
  • Every sibling control tool (set_breakpoint, start_debugging, step/continue: ~L812-823, ~L858-866, ~L1082-1092) and every other retrieval tool (get_variables/get_stack_trace/get_scopes: ~L1132-1141, ~L1155-1169, ~L1181-1190) converts the identical failure to a structured {success: false, error: ...} result.

Evidence it's drift, not design

The typed-error conversion branches inside handlePause/handleListThreads are dead code: SessionNotFoundError extends McpError (src/errors/debug-errors.ts ~L44) and is re-thrown one line earlier. docs/error-handling-guide.md's own continue example (~L89-97) contradicts actual behavior.

Suggested fix

Declare one envelope contract for session-not-found and align both handlers to the conversion path used by the other seven tools (the dead typed-error branches then become live).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions