[BUG] Sessions freezing/hanging due to 400/403 API errors during session initialization
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?
Sessions repeatedly freeze or hang, making Claude Code unusable. Investigation of the environment logs reveals persistent API errors occurring during session initialization and resume.
The errors occur in a consistent pattern:
- 400 Bad Request error during session setup
- 403 Forbidden error when attempting to fetch session logs (returns 0 entries)
These errors happen every time the session starts or resumes (using resume-cached mode), causing corrupted session state that leads to freezing.
Session ID: session_01CwnfBZYz7k3oaj2sTBUiRQ
Error timestamps from this session:
- First occurrence: 2025-11-23T06:23:43 (session start)
- Second occurrence: 2025-11-23T09:24:30 (session resume ~3 hours later)
The WebSocket connection establishes successfully, but the session runs with incomplete/corrupted state due to these initialization failures.
What Should Happen?
Session initialization should complete successfully without 400/403 errors. The session should:
- Successfully hydrate session logs from cache
- Initialize with complete session state
- Run without freezing or hanging
- Maintain stable operation throughout the session
Error Messages/Logs
2025-11-23T06:23:43.402Z [ERROR] "AxiosError: AxiosError: Request failed with status code 400\n at zj (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:24:1137)\n at IncomingMessage.<anonymous> (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:29:9828)\n at IncomingMessage.emit (node:events:531:35)\n at IncomingMessage.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1698:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at _FA.request (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:31:2130)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async O9A (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:3094)\n at async vc0 (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:80:7105)"
2025-11-23T06:23:43.616Z [DEBUG] Fetched 0 session logs for session aba8cebd-ab1c-4fc8-8dff-d3f7086411b5
2025-11-23T06:23:43.633Z [DEBUG] Hydrated 0 entries from remote
2025-11-23T06:23:43.645Z [ERROR] "AxiosError: AxiosError: Request failed with status code 403\n at zj (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:24:1137)\n at Unzip.<anonymous> (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:29:9828)\n at Unzip.emit (node:events:531:35)\n at Unzip.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1698:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at _FA.request (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:31:2130)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async XR2 (file:///opt/node22/lib/node_modules/@anthropic-ai/claude-code/cli.js:2081:5282)"
Additional context from environment-manager.out:
{"time":"2025-11-23T06:23:41.535Z","level":"INFO","msg":"Using SDK URL","sdk_url":"wss://api.anthropic.com/v1/session_ingress/ws/session_01CwnfBZYz7k3oaj2sTBUiRQ","api_version":"v1","base_url":"https://api.anthropic.com","session_id":"session_01CwnfBZYz7k3oaj2sTBUiRQ"}
{"time":"2025-11-23T06:23:41.535Z","level":"INFO","msg":"Using cloud session persistence with resume URL","resume_url":"https://api.anthropic.com/v1/session_ingress/session/session_01CwnfBZYz7k3oaj2sTBUiRQ"}
Steps to Reproduce
- Start or resume a Claude Code Web session in the web interface
- Session attempts to initialize using
resume-cachedmode - Check
/tmp/claude-code.logfor errors during initialization - Observe 400 Bad Request and 403 Forbidden errors in logs
- Session may appear to work initially but will freeze/hang during operation
- Freezing occurs repeatedly across multiple sessions
Note: This appears to be an infrastructure issue that happens automatically during session initialization - not repro
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.0.50 (Claude Code)
Platform
Other
Operating System
Other Linux
Terminal/Shell
Other
Additional Information
Environment Details
This issue occurs in the Claude Code web environment, not a local installation. The session runs in a containerized Linux environment managed by the Claude Code infrastructure.
Technical Details:
- Session mode:
resume-cached - SDK URL:
wss://api.anthropic.com/v1/session_ingress/ws/session_01CwnfBZYz7k3oaj2sTBUiRQ - API version: v1
- Environment manager session:
session_01CwnfBZYz7k3oaj2sTBUiRQ
System Resources (Normal):
- Memory: 12.9GB free out of 13.3GB (97% available)
- CPU: Idle, no resource constraints
- Disk: 30GB with only 1% used
The freezing is NOT caused by resource constraints but by API communication failures during session state management.
Pattern Observed:
The errors are consistent and reproducible:
- Session starts/resumes
- 400 error occurs during initialization
- 403 error when fetching session logs (returns 0 entries)
- Session continues with corrupted state
- Freezing/hanging occurs during subsequent operations
This affects usability significantly as sessions become unreliable and frequently unresponsive.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗