microsoft / microsoft/vscode

Agent Host (Claude): first message fails with `No conversation found with session ID` when the Claude SDK downloads lazily during the first turn

Open
#330,475 1 comment 0 reactions 1 assignee Claimed by @TylerLeonhardt View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

### Summary
On a fresh environment where the Claude agent SDK has not been cached yet, starting a **new** Claude Agent Host session and sending the **first** message reliably fails with:

```
Error: (sendFailed) Error: Claude Code returned an error result:
No conversation found with session ID:
```

The failure is deterministic on any machine/container where the SDK isn't already on disk, and disappears on machines where the SDK is already cached — which is why it tends to look "flaky" or environment-specific.

### Environment
- VS Code Insiders `1.134.0-insider`
- Agent Host, provider: **Claude** (Claude Sonnet 4.6)
- Claude agent SDK **not yet downloaded** (clean cache) — SDK version `0.3.220`
- Reproduces on Linux (arm64 and x64)

### Steps to reproduce
1. Start from a clean profile where the Claude agent SDK has **not** been downloaded yet.
2. Open a new Claude Agent Host chat session.
3. Send the first message in that session.
4. Observe that the SDK begins downloading lazily on this first turn (~2–3 min).
5. When the download completes, the send fails immediately.

### Expected
The first message in a brand-new session (`isResume=false`) should **create** the Claude conversation and succeed, regardless of whether the SDK was downloaded before or during this first turn.

### Actual
The session id is allocated **before** the SDK exists. After the SDK finishes downloading, the adapter **rebuilds the session as a resume** against a conversation id that Claude Code (freshly installed) never created, so it errors with `No conversation found`.

### Logs (Agent Host)
```
[Claude] SDK not downloaded yet; deferring session list until a session triggers the download
[Claude:] active client ... tools=[...] # session created before SDK present
[AgentSdkDownloader] claude: downloading from https://main.vscode-cdn.net/agent-sdk/claude/0.3.220/.tgz
[AgentSdkDownloader] claude: downloaded in 165s
[Claude] session : enableFileCheckpointing=true isResume=false # first turn — should CREATE
[Claude] session : resume rebuild agent=(none) # but it RESUMES
[Claude SDK stderr] No conversation found with session ID:
[AgentSideEffects] sendMessage failed for session=... : No conversation found with session ID:
```

written by Eleanor's agent

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.