[BUG] VS Code: abandoned chat panel creates stub session, "No conversation found" fires on every reload
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When the Claude Code chat panel is opened in VS Code and the workspace is closed or reloaded before any prompt is sent, the extension leaves a stub .jsonl on disk (containing only a custom-title event, no user/assistant turns) and caches the session ID in the workspace's agentSessions.model.cache (inside state.vscdb).
On every subsequent workspace reload, the extension attempts to materialize the cached session. The CLI's resume path treats turn-less files as "not a conversation" and rejects them, producing:
Error: Claude Code returned an error result: No conversation found with session ID: <uuid>
The error fires once per cached orphan entry, per reload. On a single user/single machine on 2026-04-27 this fired 51 times across 7 window reloads before being noticed. The cached entry is workspace-scoped (in the workspace's state.vscdb), so the error follows the workspace forever once seeded.
What Should Happen?
Any one of these would fix it:
- Don't write the
custom-titleevent (or any session metadata) until the first user prompt is sent. - Don't cache the session ID in
agentSessions.model.cacheuntil the session has at least one turn. - On workspace load, detect cached IDs whose backing
.jsonlis turn-less, drop them from the cache, and don't retry.
Error Messages/Logs
Error: Claude Code returned an error result: No conversation found with session ID: aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
The on-disk stub for the failing ID is just one line:
{"type":"custom-title","sessionId":"aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa","customTitle":"<title>"}
Total file size on disk: ~130 bytes.
Steps to Reproduce
- Open a VS Code window on any workspace.
- Open the Claude Code chat panel from the sidebar.
- Do not send a prompt. Close the workspace or reload the window (
Cmd+Ron macOS). - Reopen the workspace. The error toast appears.
- Reload the window again. The error fires again. It will fire on every subsequent reload because the session ID stays cached in
agentSessions.model.cache.
To clean up:
- Quit VS Code (the SQLite cache is locked while VS Code is running).
- Delete the stub
.jsonlfrom~/.claude/projects/<project>/<id>.jsonl. - Open
~/Library/Application Support/Code/User/workspaceStorage/<workspace>/state.vscdband prune the orphan ID from the JSON value ofagentSessions.model.cache(back up first).
Audit data (single user, single machine, 2026-04-27)
- 5 Claude Code projects scanned via
~/.claude/projects/*/. - 2 stub
.jsonlfiles found, both in the same project, created within ~25 minutes. - 51 error toasts fired across ~7 window reloads.
Is this a regression?
I don't know
Claude Code Version
2.1.121 (Claude Code), VS Code extension anthropic.claude-code@2.1.121
Platform
Anthropic API
Operating System
macOS 15.7.4 (Sequoia, Darwin 24.6.0)
Terminal/Shell
VS Code integrated terminal
Additional Information
The detection heuristic that worked reliably for me locally (in case it helps the upstream fix):
- Stub on disk:
.jsonlsize < 8KB AND body does not contain"type":"user"or"type":"assistant". - Orphan in cache: any session ID matching
claude-code:/[uuid]in the JSON value ofagentSessions.model.cachewhose corresponding.jsonlis missing or stub-only.
Cleanup requires VS Code to be quit (the cache SQLite is locked otherwise) and a backup of state.vscdb before pruning.
Happy to share test fixtures or detection logic if useful.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗