[BUG] claude hangs silently when ~/.claude/ is unwritable

Resolved 💬 2 comments Opened May 7, 2026 by jmelahman Closed Jun 5, 2026

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?

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.

  1. 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_

View original on GitHub ↗

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