[BUG] Claude Code exits immediately in non-git directories with "Input must be provided" error
Status Closed — not planned
Reported on v2.1.31
Maintainer reply ✓ Yes — ant-kurt
Workaround ✓ Mentioned in description ↑
Activity 6 comments · opened Feb 4, 2026 · closed Mar 24, 2026
💡 Likely answer: A maintainer (ant-kurt, collaborator)
responded on this thread — see the highlighted reply below.
Description
Claude Code v2.1.31 exits immediately when launched interactively in a directory that is not a git repository. The error (visible in debug logs) is:
Error: Input must be provided either through stdin or as a prompt argument when using --print
No --print flag is being used. The same command works in git-initialized directories.
Reproduction
mkdir /tmp/test && cd /tmp/test && claude # exits immediately
git init && claude # works
Environment
- Claude Code: 2.1.31
- OS: RHEL 9.7 (also a SLURM HPC environment)
- Shell: bash
- Terminal: /dev/pts/* (confirmed TTY with
ttyand[ -t 0 ]) - No aliases, no CLAUDECODE env vars set
Debug log observations
- All startup steps complete successfully (setup, MCP, LSP, keybindings, REPL mount)
Git remote URL: null/No git remote URL foundlogged- Process releases PID lock and exits cleanly (exit code 0) ~1s after start
- No signals received (confirmed via
strace -e trace=signal)
Related issues
- #12507 — similar HPC stdin issue, but that affects all directories
- #6820 — similar error message, but caused by
--argument parsing
Workaround
Run git init in the directory before launching Claude Code.
6 Comments
on 2.1.47 I just get this message in the debug log. CC exits without any message if it is started in a non-git directory,
This only happens on older Linux machines. on ubuntu 22 it starts ok when outside of a git repo.
Can you see if this still reproduces on Claude Code 2.1.76 ?
The "[ERROR] TypeError: TypeError: undefined is not a constructor" issue has gone away for me on newer releases of CC. Since @DanOlds had a slightly different error I would wait for his confirmation before closing
Closing for now — we still need a bit more information to move forward. Please open a new issue if this is still relevant.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.