[BUG] VS Code extension overwrites ~/.claude.json, forcing CLI onboarding on every launch

Resolved 💬 4 comments Opened Feb 26, 2026 by LouisDeGroelard-Apex Closed Apr 22, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

What's Wrong?

The VS Code extension (anthropic.claude-code) continuously overwrites ~/.claude.json while running, stripping fields like hasCompletedOnboarding, lastOnboardingVersion, projects (including hasTrustDialogAccepted), and installMethod. This forces the CLI to show the full onboarding flow (theme picker, trust dialog) every time it's launched from a VS Code terminal.

The extension rewrites ~/.claude.json on every tool use (updating toolUsage counts), but the rewrite strips fields that the CLI wrote. The userID changes on each rewrite, suggesting the extension creates a fresh config object rather than merging. firstStartTime resets repeatedly (observed 4 resets in a single session). The CLAUDECODE=1 environment variable injected by the extension also blocks CLI launches entirely.

This is a regression — running the extension and CLI side by side in VS Code previously worked without issues.

What Should Happen?

  1. The extension should merge into ~/.claude.json rather than overwriting it, preserving fields written by the CLI
  2. Or: the extension and CLI should use separate config storage so they don't conflict
  3. The CLAUDECODE=1 env var should not be injected into user-opened terminals (only into extension-managed terminals)

Error Messages/Logs

When trying to launch CLI from VS Code terminal:

Error: Claude Code cannot be launched inside another Claude Code session.
Nested sessions share runtime resources and will crash all active sessions.
To bypass this check, unset the CLAUDECODE environment variable.


After clearing `CLAUDECODE`, full onboarding is shown instead of the normal CLI prompt.

During debugging, `~/.claude.json` was fully reset at least 4 times:
- `firstStartTime` changed from `12:15:48Z` → `14:30:34Z` → `15:19:35Z` (all same day)
- `userID` changed 3 times (3 distinct hashes)
- Fields like `hasCompletedOnboarding`, `projects`, `installMethod` were present after manual edit, then gone seconds later

Steps to Reproduce

  1. Open VS Code with the anthropic.claude-code extension installed and active
  2. Open a PowerShell terminal inside VS Code
  3. Clear the CLAUDECODE env var: Remove-Item Env:\CLAUDECODE
  4. Run claude
  5. Complete the onboarding (theme, trust dialog, login)
  6. Verify ~/.claude.json contains "hasCompletedOnboarding": true
  7. Wait a few seconds — the extension overwrites the file, losing those fields
  8. Open another terminal tab, run claude again → full onboarding shown again

Note: The bug also happens with Python files containing CLI scripts.

Claude Model

Not sure / Multiple models

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.59

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

  • Workarounds attempted (none effective): manually setting hasTrustDialogAccepted: true via sed (overwritten within seconds), adding hasCompletedOnboarding: true (overwritten), PowerShell profile wrapper to fix config before each launch (overwritten between write and CLI read), CLAUDE_CONFIG_DIR pointing CLI to separate directory (did not help)
  • Only effective workaround: uninstall the extension entirely and use CLI only
  • The v2.1.59 changelog mentions "Fixed config file corruption that could wipe authentication when multiple Claude Code instances ran simultaneously" — this fix does not appear to resolve the issue on Windows when the extension and CLI coexist
  • Related issues: #22602, #8385, #14023, #4714, #3833

View original on GitHub ↗

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