Skip to content

[BUG] macOS: startup can block with no timeout on a folder named in a Read deny rule or sandbox denyRead #103914

Open

Description

@therealDimitri

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?

With 7 macOS-protected folders denied in my settings (Documents, Desktop, Downloads, iCloud Drive, Mail, Messages, Cookies), Claude Code opened ~/Library/Mail while starting up. That's the folder named in a Read(...) rule in permissions.deny. When that open waits on macOS, startup doesn't finish. It doesn't time out or log an error. Ours sat for 49 minutes and for 3 h 48 min before being killed.

It hit a headless job run by launchd (claude -p ... --settings <file>). The settings deny those folders so the job can't read them. The morning after an update (2.1.304), the 06:00 run blocked in open() behind a cloud-storage consent request nobody was there to answer. macOS asks again for each new version. I didn't capture which path that run was opening.

What Should Happen?

A deny rule shouldn't need to open the folder it denies. If startup has to touch it, a check that can't block, or a short timeout that names the path, would let the run carry on or fail clearly.

Error Messages/Logs

No error is logged. A `sample` of the stuck process shows the main thread in `__openat_nocancel` the whole time.

Steps to Reproduce

What I saw (the 06:00 case, observed rather than set up):

  1. A settings file whose permissions.deny has Read(...) rules for macOS-protected folders (ours named 7), passed with --settings.
  2. A new Claude Code version lands overnight, so macOS hasn't been answered for it yet.
  3. launchd runs claude -p "<prompt>" --settings <file> with nobody at the screen.
  4. It never reaches its first turn, and no transcript is written.

What I tested: 14 runs on 2.1.305, all with prompt "reply ok". All of them ran while macOS's privacy broker appeared stuck: no broker log output for hours, and /bin/ls ~/Library/Mail from a plain shell blocked too.

  • 7 folders in both lists: hangs
  • In the deny rules only: hangs
  • In sandbox.filesystem.denyRead only: hangs (1 run; I traced the open only for the deny rules)
  • In neither: finishes in 3 to 20 s
  • Bracketed form, e.g. Read(~/Document[s]/**): still hangs

In that state each open waited 5 s, returned EINTR, and Claude Code retried straight away with no sign of stopping: 13 tries in 60 s, and the same launch sat in open() for 49 min.

After a restart the same settings started in 7 s on 2.1.306, once someone clicked Allow on its consent prompt.

Not tested: a single deny rule on its own, and the consent-pending case with nobody at the screen in a controlled run.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.305 (all tests). 2.1.304 hung the same way at startup with the same settings, path not captured. 2.1.306 is installed now; I haven't re-run the hang case on it.

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Non-interactive/CI environment

Additional Information

macOS 27.0.1 (26A434), Apple silicon, native install. The job runs from a launchd LaunchAgent with -p.

Possibly related: #101404, a Linux freeze on a denyRead glob, which mentions an earlier fix in 2.1.290 for a freeze at startup.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions