[BUG] Claude Code hangs/freezes when opening an empty directory
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 happening:
When I open an empty directory with Claude Code (version 2.1.74), the application freezes during startup and becomes completely unresponsive - no input is accepted.
What Should Happen?
Claude Code should start normally in any directory, including empty ones, without hanging or requiring manual intervention.
Error Messages/Logs
Steps to Reproduce
Problem:
When opening an empty directory (or a directory with only a .git folder but no commits), Claude Code becomes unresponsive during initialization, or ClaudeCode program just exit.
Steps to Reproduce:
- Create a new empty directory: mkdir tmp-xxx && cd tmp-xxx
- Start Claude Code in this directory: claude
- The application hangs and cannot accept input
Workaround:
Running git init in the empty directory before or after starting Claude Code resolves the issue and allows normal operation.
Additional Context:
- ~/.claude.json configuration file exists and is valid
- ~/.claude/projects directory exists with proper permissions
- The issue appears to be related to git repository state detection during initialization
- Once git init is executed, the session works perfectly
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.2xx
Claude Code Version
2.1.74
Platform
Anthropic API
Operating System
Other Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
Environment:
- Claude Code version: 2.1.74
- OS: Linux (4.19.112-2.el8.x86_64)
- Shell: bash
- Platform: Native installation
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗