[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
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 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 ↗

6 Comments

primerano · 7 months ago

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,

[ERROR] TypeError: TypeError: undefined is not a constructor (evaluating 'new(await Promise.resolve().then(() => (pjA(),mjA))).FileIndex')
    at TG1 (/$bunfs/root/claude:3164:18755)
    at async GxD (/$bunfs/root/claude:3166:1544)
    at processTicksAndRejections (native:7:39)
primerano · 7 months ago
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, `` [ERROR] TypeError: TypeError: undefined is not a constructor (evaluating 'new(await Promise.resolve().then(() => (pjA(),mjA))).FileIndex') at TG1 (/$bunfs/root/claude:3164:18755) at async GxD (/$bunfs/root/claude:3166:1544) at processTicksAndRejections (native:7:39) ``

This only happens on older Linux machines. on ubuntu 22 it starts ok when outside of a git repo.

ant-kurt collaborator · 7 months ago

Can you see if this still reproduces on Claude Code 2.1.76 ?

primerano · 7 months ago

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

github-actions[bot] · 6 months ago

Closing for now — we still need a bit more information to move forward. Please open a new issue if this is still relevant.

github-actions[bot] · 6 months ago

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.