Skip to content

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

Open

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: <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:<id>] active client ... tools=[...]                 # session created before SDK present
[AgentSdkDownloader] claude: downloading from https://main.vscode-cdn.net/agent-sdk/claude/0.3.220/<arch>.tgz
[AgentSdkDownloader] claude: downloaded in 165s
[Claude] session <id>: enableFileCheckpointing=true isResume=false     # first turn — should CREATE
[Claude] session <id>: resume rebuild agent=(none)                      # but it RESUMES
[Claude SDK stderr] No conversation found with session ID: <id>
[AgentSideEffects] sendMessage failed for session=... : No conversation found with session ID: <id>

written by Eleanor's agent

Activity

  1. richsills commented on Sep 3, 2026

    @richsills

    Hitting this same lazy-download path from a different angle: a case where the SDK download is never triggered at all, so the session cannot start and the model list stays empty. Same deferral message as in the report above, but it never resolves — there is no 2–3 minute wait and no eventual resume error, because nothing is ever downloaded.

    How you get there

    A VS Code update that moves the agentSdks.claude pin. Here 1.135.x → 1.136.0 moved it from 0.3.220 to 0.3.239. The cache is keyed by version, so the existing 0.3.220/win32-x64 tree is bypassed rather than upgraded, and the newly pinned version has never been fetched.

    The cycle

    The download is deferred until a session triggers it, but no session can start:

    1. No cached SDK for the pinned version, so no accountInfo()
    2. → hasExistingSetup is false
    3. → transport resolves to proxy via the hasExistingSetup ? native : proxy fallback
    4. → proxy requires GitHub/Copilot auth; this account has no Copilot licence → 403
    5. → createSession fails, so nothing ever triggers the download → back to 1

    This is stable across restarts. The only exit I found was placing the SDK on disk by hand.

    Log signature

    agenthost.log (paths and identifiers redacted):

    [info]  [Claude] Models refreshed (merged). Count: 0,
    [info]  [Claude] SDK not downloaded yet; deferring chat metadata until a session triggers the download
            ... (repeats ~100 times, once per metadata request)
    [error] [ProtocolServer] Request 'createSession' failed Authentication is required to use Claude
    

    Native account check never appears at all in this state.

    That error text is also misleading — it reads as an Anthropic credential problem, but the underlying failure is the Copilot 403, visible only in GitHub Copilot Chat.log:

    [warning] Failed to get copilot token due to status 403
    [warning] No access to GitHub Copilot found. You are currently logged in as <redacted>.
    [error]   Failed to fetch models: Error: 403 "unauthorized: not authorized to use this Copilot feature"
    

    (#323049 already proposes surfacing BYOK guidance when a native turn fails with an auth error, which would have helped a lot here.)

    There is no user-side escape

    • Signing out of GitHub does not help — that path also resolves to proxy, via the same false hasExistingSetup.
    • Explicitly selecting an Anthropic-provider model to force native is impossible, because the picker is empty.
    • Setting chat.defaultModel to an explicit @provider=anthropic:… id does not help either: the configured value is resolved against the list of available models, which is empty, so it yields no model and the transport falls back to the default.

    Recovery

    Unpack the pinned version into the cache, writing the .complete sentinel last:

    <userdata>/agent-host/sdk-cache/claude/0.3.239/win32-x64/
        node_modules/…        (the tarball's root is node_modules/, so it extracts straight in)
        .complete             (0 bytes, written last)
    

    Afterwards — with the GitHub session still signed in and otherwise untouched — the account check runs and the picker fills immediately:

    [Claude] Native account check: setUp=true, provider=firstParty, tokenSource=CLAUDE_CODE_OAUTH_TOKEN, apiKeySource=absent
    [Claude] Models refreshed (merged). Count: 3, Sonnet, Opus, Haiku
    

    That confirms the empty model list was caused solely by the missing SDK, independently of GitHub auth state.

    Suggestion

    Provisioning probably should not sit behind the transport/auth gate. If the download were triggered by the native account check, or by opening the Agents window, rather than by createSession, this state would not be reachable. #332295 would also remove the entry condition altogether, by not pinning a version that a version-keyed cache can miss.


    Environment: VS Code 1.136.0 and 1.136.1, Windows 11 x64, win32-x64 target, Anthropic credentials via CLAUDE_CODE_OAUTH_TOKEN, chat.agentHost.allowSignedOutWhenUsable: true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

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