VSCode/Cursor extension: permission-IPC race kills sessions, error rendered as "[object Object]"

Resolved 💬 4 comments Opened May 14, 2026 by kesuraya Closed Jun 12, 2026

Environment

  • Extension: Anthropic.claude-code version 2.1.141
  • Harness: Cursor (also reportedly affects vanilla VSCode build of the same extension; same codebase)
  • OS: macOS 14.x (Darwin 24.6.0)
  • Model: claude-opus-4-7 (1M context)
  • Session length when reproducing: ~2 hours, hundreds of tool calls

Summary

Two stacked bugs, one root cause:

  1. Permission-IPC race. The IPC channel between the agent process and the webview-side permission UI can close while a permission request is pending. The agent throws Tool permission request failed: Error: Tool permission stream closed before response received and the session dies — no retry, no recoverable error UI.
  2. Error rendered as [object Object]. The toast / error surface for this case renders the Error object via template-literal interpolation (${err}) or String(err) rather than err.message, so users see the literal string Unhandled case: [object Object] and have no way to diagnose without digging into log files. This blocks self-service triage.

Real error message (preserved in the session jsonl)

Tool permission request failed: Error: Tool permission stream closed before response received

Visible by tailing ~/.claude/projects/<project-slug>/<sessionId>.jsonl — the toolUseResult field on the final user-side message carries the real string.

Reproduction signal

  • Correlates with session length / tool-call volume, not with prompt size or specific content. In the session that triggered this report, autocompact level=ok effectiveWindow=980000 was logged in the activity log immediately before the crash — context window was well within bounds.
  • Triggers most reliably during heavy back-and-forth: long sessions with frequent tool permission prompts. Less reliable / never seen with --permission-mode bypassPermissions, where the permission stream isn't opened for routine tool calls.

Suggested fixes

  1. Permission-IPC retry. Treat permission stream closed as a recoverable failure: reopen the stream, re-issue the pending request once, fail visibly with an actionable surface (e.g. "permission request timed out — re-request?") rather than killing the session.
  2. Toast error rendering. Replace whatever uses ${err} / String(err) with err instanceof Error ? err.message : String(err) (or similar). This is a single-line fix that would have made the underlying bug self-diagnosable.

Workaround in the meantime

/permissions → "Bypass permissions" (or --permission-mode bypassPermissions on the CLI) keeps the permission stream from being queried for routine tool calls. The race cannot fire in that mode.

Reference

  • Crashed session id: a432b005-a9d8-4959-95b7-1214f07cdb94
  • Extension activity log: ~/Library/Application Support/Cursor/logs/<dir>/window1/exthost/Anthropic.claude-code/Claude VSCode.log
  • Tail of the session jsonl carries the full diagnostic context.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗