Observed behaviour
When a query is sent and then immediately aborted (Escape pressed before any response text appears), the entire process crashes with an unhandled error:
u$ [Error]: Operation aborted
at Q0.write (file:///Users/stephen/Library/pnpm/global/5/.pnpm/@anthropic-ai+claude-agent-sdk@0.2.83_zod@4.3.6/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:19:6997)
at G0.handleControlRequest (file:///Users/stephen/Library/pnpm/global/5/.pnpm/@anthropic-ai+claude-agent-sdk@0.2.83_zod@4.3.6/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs:20:161)
at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
Expected behaviour
Aborting a query should cancel it gracefully and return to the prompt, regardless of timing. This works correctly when Escape is pressed after output has started.
Reproduction
- Start claude-cli
- Send any query
- Immediately press Escape (before any response text appears)
- Process crashes with the stack trace above
Environment
@anthropic-ai/claude-agent-sdk@0.2.83
- Node.js v24.14.1
Observed behaviour
When a query is sent and then immediately aborted (Escape pressed before any response text appears), the entire process crashes with an unhandled error:
Expected behaviour
Aborting a query should cancel it gracefully and return to the prompt, regardless of timing. This works correctly when Escape is pressed after output has started.
Reproduction
Environment
@anthropic-ai/claude-agent-sdk@0.2.83