[BUG] Claude Code exits immediately in non-git directories with "Input must be provided" error

Resolved 💬 6 comments Opened Feb 4, 2026 by DanOlds Closed Mar 24, 2026

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 tty and [ -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 found logged
  • 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.

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗