[BUG] VSCode: Fork conversation while model is generating spawns with resume: undefined, immediately exits
Description
Forking a conversation while the model is actively generating fails silently. The fork request succeeds (file history is hard-linked), but the new Claude process spawns with resume: undefined and exits immediately (~200ms after start).
Environment
- OS: macOS (Darwin 25.1.0, Apple Silicon)
- VSCode Extension: v2.1.71
- Auth: OAuth (Anthropic)
Steps to Reproduce
- Start a conversation in the Claude Code VSCode extension
- Send a message and wait for the model to begin generating a response
- While the response is still streaming, click "Fork conversation from here" on a previous message
- A new tab opens but the forked session immediately dies
Expected Behavior
The forked conversation should open in a new tab with the conversation history up to the fork point, ready for a new prompt.
Actual Behavior
The new tab opens briefly, then the Claude process exits. The error Failed to fetch Claude settings: Error: Query closed before response received appears in the extension logs.
Log Analysis
The fork request itself succeeds — file history hard-links are created:
Received message from webview: {"type":"request",...,"request":{"type":"fork_conversation","forkedFromSession":"67c9473d-...","resumeSessionAt":"8a66cc2c-..."}}
FileHistory: Hard linked backup 16a17a605bc47e89@v2 from 67c9473d-... to b9850d99-...
FileHistory: Hard linked backup 43954cdbd0d12487@v4 from 67c9473d-... to b9850d99-...
[... more hard links succeed ...]
But the new process spawns without the session ID:
Spawning Claude with SDK query function - cwd: /Users/.../fyp, permission mode: default, version: 2.1.71, ..., resume: undefined
The process then immediately shuts down:
[DEBUG] Getting matching hook commands for SessionStart with query: startup
[DEBUG] Found 0 hook matchers in settings
[... ~200ms later ...]
[DEBUG] Getting matching hook commands for SessionEnd with query: other
[DEBUG] LSP server manager shut down successfully
Followed by:
[error] Failed to fetch Claude settings: Error: Query closed before response received
Root Cause Hypothesis
Race condition: when forking mid-generation, the extension tears down the active streaming session to create the fork, but the new session's spawn doesn't receive the sessionId/resume parameter (it's undefined). The forked process starts as a blank session and immediately exits.
Related Issues
- #22016 — Fork doesn't work (Windows, ENOENT on
.claude/projects/dir — different root cause) - #23692 — Forked sessions not in
/resumelist, unexpected termination (index not updated — different root cause)
Workaround
Wait for the model to finish generating before forking.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗