[BUG] Session hangs at 0 tokens after background task completes with --dangerously-skip-permissions
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?
When using --dangerously-skip-permissions mode and running a background task (like starting a dev server), the session hangs after the task completes.
The thinking indicator shows "0 tokens" indefinitely and never returns to the prompt.
The API connection works fine - simple prompts via echo "hello" | claude --print succeed. The issue is specific to sessions with background tasks in
--dangerously-skip-permissions mode.
What Should Happen?
After the background task completes, Claude should finish its response and return to the input prompt, ready for the next command.
Error Messages/Logs
No error message - just hangs indefinitely at the thinking indicator (e.g., "Concocting...", "Transfiguring...") showing "0 tokens" with no response.
Steps to Reproduce
- Navigate to a project with a dev server (e.g., a Tauri/Vite project)
- Run
claude --dangerously-skip-permissions - Ask Claude to "start the dev server" (or any command that triggers a background bash task)
- Wait for the background task to complete successfully
- Observe the thinking indicator shows "0 tokens" and never completes
Note: Running echo "hello" | claude --print works fine, confirming API connectivity is not the issue. The bug only occurs after background task completion in --dangerously-skip-permissions mode.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
Last NPM version that was available.
Claude Code Version
2.1.15 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
- Running without
--dangerously-skip-permissionsdoes not exhibit this issue /tasksshows no background tasks when the hang occurs- Fresh sessions work until a background task completes
- Killing the hung session and starting fresh temporarily resolves it
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗