claude-code - 💡(How to fix) Fix [BUG] claude hangs silently when ~/.claude/ is unwritable

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

  1. claude (no flags) hangs indefinitely with no output. No error, no prompt,
  2. claude --debug exits with an ENOENT from appendFileSync, but the error

Error Messages/Logs

Code Example

Actual stack (truncated, from `claude --debug`)

ENOENT: no such file or directory, open
 syscall: "open", errno: -2, code: "ENOENT"
   at appendFileSync (/$bunfs/root/src/entrypoints/cli.js:55:1552)
   at writeFn          (/$bunfs/root/src/entrypoints/cli.js:59:7898)
   ...
Bun v1.3.14 (Linux x64 baseline)

---

FROM ubuntu:24.04
RUN apt-get update && apt-get install -y curl ca-certificates \
 && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
 && apt-get install -y nodejs \
 && npm install -g @anthropic-ai/claude-code
RUN useradd -m dev && chown root:root /home/dev   # simulate broken
ownership
USER dev
CMD ["claude"]
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Summary When the user running claude lacks write access to ~/.claude/ (e.g. $HOME exists but is owned by another user, so the .claude directory can't be created), two things go wrong:

  1. claude (no flags) hangs indefinitely with no output. No error, no prompt, nothing — you have to ^C.
  2. claude --debug exits with an ENOENT from appendFileSync, but the error doesn't include the path it tried to open, so you can't tell which file/dir is the problem.

What Should Happen?

  • Fail fast at startup with something like: cannot write to ~/.claude (permission denied) and exit non-zero.
  • All filesystem errors should include the offending path in the message.

Error Messages/Logs

Actual stack (truncated, from `claude --debug`)

ENOENT: no such file or directory, open
 syscall: "open", errno: -2, code: "ENOENT"
   at appendFileSync (/$bunfs/root/src/entrypoints/cli.js:55:1552)
   at writeFn          (/$bunfs/root/src/entrypoints/cli.js:59:7898)
   ...
Bun v1.3.14 (Linux x64 baseline)

Steps to Reproduce

Given the following Dockerfile,

FROM ubuntu:24.04
RUN apt-get update && apt-get install -y curl ca-certificates \
 && curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
 && apt-get install -y nodejs \
 && npm install -g @anthropic-ai/claude-code
RUN useradd -m dev && chown root:root /home/dev   # simulate broken
ownership
USER dev
CMD ["claude"]

docker run --rm -it <image> → hangs. docker run --rm -it <image> claude --debug → ENOENT stack trace without a path.

I am also running rootless docker if that makes a difference.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.132

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Other

Additional Information

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING