claude-code - 💡(How to fix) Fix [BUG] can't run trunk with sandbox mode enabled [1 participants]

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…
GitHub stats
anthropics/claude-code#52536Fetched 2026-04-24 06:04:33
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Error Message

Error

Error Messages/Logs

And if you ran trunk with verbose output, you'd also see the earlier connection error before the sandbox settings were tuned:

Root Cause

Root cause

Fix Action

Fix / Workaround

Workaround

Code Example

setpriority() failed: Operation not permitted                                                                                                                                                                                                   
                                                                                                                                                                                                                                                  
  And if you ran trunk with verbose output, you'd also see the earlier connection error before the sandbox settings were tuned:                                                                                                                   
                                                                                                                                                                                                                                                  
  failed to connect to all addresses; ipv4:127.0.0.1:0 Operation not permitted                                                                                                                                                                    
                                                                                                                                                                                                                                                  
  The setpriority() one is the core issue — that's the one that persists even after the network settings are fixed.
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?

Title: macOS sandbox blocks setpriority() on child processes, breaking trunk and similar daemon-based tools

Body:

Summary

On macOS, the Claude Code sandbox profile allows process-info* only with (target same-sandbox). This blocks any tool that calls setpriority() on child processes that were not exec'd inside the sandbox, which breaks trunk and likely other
daemon-based linters/formatters.

Root cause

The hardcoded macOS SBPL profile contains:
(allow process-info* (target same-sandbox))

Trunk's architecture is: CLI → gRPC daemon (spawned on first run, persists across calls) → worker processes (eslint, prettier, etc.). The daemon calls setpriority() on its worker processes. Since the workers may not satisfy (target same-sandbox), this syscall is denied with "Operation not permitted", and all linters fail.

Error

trunk: setpriority() failed: Operation not permitted

Workaround

Pass dangerouslyDisableSandbox: true on every trunk Bash call. This works but defeats the purpose of sandboxing.

Requested fix

Add a settings.json option — e.g.:

{
"sandbox": {
"process": { "allowSetpriority": true } }
}

…that would loosen the process-info* rule to allow setpriority() on non-sandboxed child processes. This would let trunk (and similar tools like bazel, cargo, sbt) work within the sandbox without a full bypass.

Environment

  • macOS 15.x (Darwin 25.x)
  • Claude Code CLI
  • trunk v1.x

What Should Happen?

Running trunk check (or any tool that uses setpriority() on child processes) inside the Claude Code sandbox should succeed without requiring dangerouslyDisableSandbox: true. The sandbox should provide a settings.json option to allow ▎ process-info* without the (target same-sandbox) restriction, so daemon-based tools can nicely coexist with sandboxing rather than requiring a full bypass.

Error Messages/Logs

setpriority() failed: Operation not permitted                                                                                                                                                                                                   
                                                                                                                                                                                                                                                  
  And if you ran trunk with verbose output, you'd also see the earlier connection error before the sandbox settings were tuned:                                                                                                                   
                                                                                                                                                                                                                                                  
  failed to connect to all addresses; ipv4:127.0.0.1:0 Operation not permitted                                                                                                                                                                    
                                                                                                                                                                                                                                                  
  The setpriority() one is the core issue — that's the one that persists even after the network settings are fixed.

Steps to Reproduce

  1. Install trunk in a repo (trunk init)
  2. Open Claude Code in that repo (sandbox enabled, default settings)
  3. Ask Claude to run trunk check <some-file>
  4. Claude runs trunk check via the Bash tool (sandboxed)

Result: trunk fails with setpriority() failed: Operation not permitted

Note: Running trunk check directly in a terminal outside Claude Code succeeds. The failure is specific to the Claude Code sandbox environment.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.118 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

No response

extent analysis

TL;DR

The issue can be fixed by adding a settings.json option to loosen the process-info* rule, allowing setpriority() on non-sandboxed child processes.

Guidance

  • The root cause is the hardcoded macOS SBPL profile (allow process-info* (target same-sandbox)) which blocks setpriority() on child processes not exec'd inside the sandbox.
  • To verify the issue, run trunk check inside the Claude Code sandbox and check for the "Operation not permitted" error.
  • A potential workaround is to pass dangerouslyDisableSandbox: true on every trunk Bash call, but this defeats the purpose of sandboxing.
  • The requested fix is to add a settings.json option, e.g., "sandbox": { "process": { "allowSetpriority": true } }, to allow setpriority() on non-sandboxed child processes.

Example

No code snippet is provided as the issue is related to configuration and sandboxing.

Notes

The issue is specific to the Claude Code sandbox environment on macOS and does not occur when running trunk check directly in a terminal outside Claude Code.

Recommendation

Apply a workaround by adding the requested settings.json option to allow setpriority() on non-sandboxed child processes, as this would enable daemon-based tools like trunk to work within the sandbox without requiring a full bypass.

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

claude-code - 💡(How to fix) Fix [BUG] can't run trunk with sandbox mode enabled [1 participants]