claude-code - 💡(How to fix) Fix [BUG] Claude Code hangs on logout/token refresh, corrupts settings.json and leaves orphan lock files — Windows ARM64 [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52237Fetched 2026-04-24 06:12:31
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

  • Better error message when settings.json fails to parse (currently shows fake login screen)

Error Messages/Logs

Root Cause

ROOT CAUSE:

  • Shutdown handler does not delete .lock files on Windows ARM64
  • Reconnection retry loop writes malformed permission strings to settings.json
  • Specifically: "Bash(node -e ' *)" and "Bash(powershell -Command ' *)" — unclosed quotes

Fix Action

Fix / Workaround

WORKAROUND: Remove-Item "$env:USERPROFILE.claude\ide*.lock" -Force Remove-Item "$env:USERPROFILE.claude\settings.json" -Force

Code Example

query closed before response recieveed
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

What's Wrong?

Platform: Windows ARM64 (Snapdragon) Claude Code version: 2.1.118 Plan: Max 5x

RECURRING BUG (every ~7 days): When the OAuth token expires or user logs out, Claude Code hangs mid-shutdown and never cleans up properly. This causes:

ROOT CAUSE:

  • Shutdown handler does not delete .lock files on Windows ARM64
  • Reconnection retry loop writes malformed permission strings to settings.json
  • Specifically: "Bash(node -e ' *)" and "Bash(powershell -Command ' *)" — unclosed quotes

PROPER FIX NEEDED:

  • Clean shutdown handler that deletes lock files before exit
  • Validation on permission strings before writing to settings.json
  • Better error message when settings.json fails to parse (currently shows fake login screen)

What Should Happen?

  1. Orphan lock files left in ~/.claude/ide/*.lock
  2. Failed reconnection attempts write broken/malformed entries into settings.json
  3. On next launch, settings.json crashes the process instantly
  4. User sees "Query closed before response received" on login screen
  5. Completely locked out — looks like an auth failure but isn't

Error Messages/Logs

query closed before response recieveed

Steps to Reproduce

logout , or get disconected

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.1.18

Platform

Other

Operating System

Windows

Terminal/Shell

Terminal.app (macOS)

Additional Information

WORKAROUND: Remove-Item "$env:USERPROFILE.claude\ide*.lock" -Force Remove-Item "$env:USERPROFILE.claude\settings.json" -Force

extent analysis

TL;DR

Delete orphan lock files and malformed settings.json to temporarily resolve the shutdown issue.

Guidance

  • Verify the presence of .lock files in ~/.claude/ide/ and remove them manually or using the provided PowerShell command Remove-Item "$env:USERPROFILE\.claude\ide\*.lock" -Force.
  • Check settings.json for malformed permission strings and remove the file if necessary, using Remove-Item "$env:USERPROFILE\.claude\settings.json" -Force.
  • To prevent future occurrences, consider implementing a clean shutdown handler that deletes lock files before exit and validates permission strings before writing to settings.json.
  • Monitor the application for reconnection attempts that may write broken entries into settings.json.

Example

The provided PowerShell commands can be used to remove the problematic files:

Remove-Item "$env:USERPROFILE\.claude\ide\*.lock" -Force
Remove-Item "$env:USERPROFILE\.claude\settings.json" -Force

Notes

This workaround may not address the underlying issue, and a proper fix is needed to prevent future occurrences. The root cause analysis suggests that the shutdown handler and permission string validation need to be improved.

Recommendation

Apply the provided workaround to temporarily resolve the issue, as a proper fix is not available yet. This will allow users to regain access to the application while a more permanent solution is developed.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING