Shell Command -- posix_spawnp failed (only under sandbox)

### What happened?

### ❯ gemini **-s** -dyp "echo my PATH"  # notice -s for sandbox
[DEBUG] CLI: Delegating hierarchical memory load to server for CWD: /Users/jagman/gemini/wrgmtls (memoryImportFormat: tree)
[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD: /Users/jagman/gemini/wrgmtls (importFormat: tree)
[DEBUG] [MemoryDiscovery] Found readable global GEMINI.md: /Users/jagman/.gemini/GEMINI.md
[DEBUG] [MemoryDiscovery] Searching for GEMINI.md starting from CWD: /Users/jagman/gemini/wrgmtls
[DEBUG] [MemoryDiscovery] Determined project root: /Users/jagman/gemini/wrgmtls
[DEBUG] [BfsFileSearch] Scanning [1/200]: batch of 1
[DEBUG] [BfsFileSearch] Scanning [16/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [31/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [46/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [61/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [76/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [91/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [106/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [121/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [136/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [151/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [166/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [181/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [196/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [200/200]: batch of 4
[DEBUG] [MemoryDiscovery] Final ordered GEMINI.md paths to read: ["/Users/jagman/.gemini/GEMINI.md","/Users/jagman/gemini/wrgmtls/GEMINI.md"]
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /Users/jagman/gemini/wrgmtls/GEMINI.md (Length: 4672)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /Users/jagman/.gemini/GEMINI.md (Length: 4218)
[DEBUG] [MemoryDiscovery] Combined instructions length: 9060
[DEBUG] [MemoryDiscovery] Combined instructions (snippet): --- Context from: ../../.gemini/GEMINI.md ---
GEMINI.md for ~jagman/.gemini/

NOTE: Although intially writen by the user, it is the AI which reads and processes the file internally. Thus, in this document,
the pronouns "I", "me", "my" refer to the gemini-cli assistant, and the pronouns "you", "they", "their" refer to the user. In
conversation, normal pronoun usage will be used.

I am named "Gemini". If you are logged in with the username of 'jagman', then you are named "JAG" (pronounced as a wor...
Loaded cached credentials.
Flushing log events to Clearcut.
using macos seatbelt (profile: permissive-open) ...
[DEBUG] CLI: Delegating hierarchical memory load to server for CWD: /Users/jagman/gemini/wrgmtls (memoryImportFormat: tree)
[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD: /Users/jagman/gemini/wrgmtls (importFormat: tree)
[DEBUG] [MemoryDiscovery] Found readable global GEMINI.md: /Users/jagman/.gemini/GEMINI.md
[DEBUG] [MemoryDiscovery] Searching for GEMINI.md starting from CWD: /Users/jagman/gemini/wrgmtls
[DEBUG] [MemoryDiscovery] Determined project root: /Users/jagman/gemini/wrgmtls
[DEBUG] [BfsFileSearch] Scanning [1/200]: batch of 1
[DEBUG] [BfsFileSearch] Scanning [16/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [31/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [46/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [61/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [76/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [91/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [106/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [121/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [136/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [151/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [166/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [181/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [196/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [200/200]: batch of 4
[DEBUG] [MemoryDiscovery] Final ordered GEMINI.md paths to read: ["/Users/jagman/.gemini/GEMINI.md","/Users/jagman/gemini/wrgmtls/GEMINI.md"]
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /Users/jagman/gemini/wrgmtls/GEMINI.md (Length: 4672)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /Users/jagman/.gemini/GEMINI.md (Length: 4218)
[DEBUG] [MemoryDiscovery] Combined instructions length: 9060
[DEBUG] [MemoryDiscovery] Combined instructions (snippet): --- Context from: ../../.gemini/GEMINI.md ---
GEMINI.md for ~jagman/.gemini/

NOTE: Although intially writen by the user, it is the AI which reads and processes the file internally. Thus, in this document,
the pronouns "I", "me", "my" refer to the gemini-cli assistant, and the pronouns "you", "they", "their" refer to the user. In
conversation, normal pronoun usage will be used.

I am named "Gemini". If you are logged in with the username of 'jagman', then you are named "JAG" (pronounced as a wor...
Loaded cached credentials.
Flushing log events to Clearcut.
[AgentRegistry] Initialized with 1 agents.
Flushing log events to Clearcut.
Session ID: c32bbddc-75b9-4cab-8d8a-aef4c22e090b

> missing pgrep output
> Error executing tool run_shell_command: posix_spawnp failed.
> Error executing tool read_file: File path must be within one of the workspace directories: /Users/jagman/gemini/wrgmtls or within the project temp directory: /Users/jagman/.gemini/tmp/70dcd1ebe76db351c8dcaa1c22a5a99bea50aab3742a301b8e5d4ab0ede83128
> missing pgrep output
> Error executing tool run_shell_command: posix_spawnp failed.
> I am unable to retrieve your PATH variable. The execution of shell commands like `echo $PATH` and `env` is failing, likely due to the security sandbox I am operating in. This is further confirmed by my inability to access system files like `/etc/paths`.
> 
> This might be due to the macOS Seatbelt, which restricts my access to system resources for security reasons. You may need to adjust your Seatbelt profile to allow me to execute shell commands if you want me to be able to access your PATH.Flushing log events to Clearcut.

### What did you expect to happen?

### ❯ gemini -dyp "echo my PATH"  # notice no sandbox
[DEBUG] CLI: Delegating hierarchical memory load to server for CWD: /Users/jagman/gemini/wrgmtls (memoryImportFormat: tree)
[DEBUG] [MemoryDiscovery] Loading server hierarchical memory for CWD: /Users/jagman/gemini/wrgmtls (importFormat: tree)
[DEBUG] [MemoryDiscovery] Found readable global GEMINI.md: /Users/jagman/.gemini/GEMINI.md
[DEBUG] [MemoryDiscovery] Searching for GEMINI.md starting from CWD: /Users/jagman/gemini/wrgmtls
[DEBUG] [MemoryDiscovery] Determined project root: /Users/jagman/gemini/wrgmtls
[DEBUG] [BfsFileSearch] Scanning [1/200]: batch of 1
[DEBUG] [BfsFileSearch] Scanning [16/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [31/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [46/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [61/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [76/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [91/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [106/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [121/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [136/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [151/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [166/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [181/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [196/200]: batch of 15
[DEBUG] [BfsFileSearch] Scanning [200/200]: batch of 4
[DEBUG] [MemoryDiscovery] Final ordered GEMINI.md paths to read: ["/Users/jagman/.gemini/GEMINI.md","/Users/jagman/gemini/wrgmtls/GEMINI.md"]
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /Users/jagman/gemini/wrgmtls/GEMINI.md (Length: 4672)
[DEBUG] [MemoryDiscovery] Successfully read and processed imports: /Users/jagman/.gemini/GEMINI.md (Length: 4218)
[DEBUG] [MemoryDiscovery] Combined instructions length: 9060
[DEBUG] [MemoryDiscovery] Combined instructions (snippet): --- Context from: ../../.gemini/GEMINI.md ---
GEMINI.md for ~jagman/.gemini/

NOTE: Although intially writen by the user, it is the AI which reads and processes the file internally. Thus, in this document,
the pronouns "I", "me", "my" refer to the gemini-cli assistant, and the pronouns "you", "they", "their" refer to the user. In
conversation, normal pronoun usage will be used.

I am named "Gemini". If you are logged in with the username of 'jagman', then you are named "JAG" (pronounced as a wor...
Loaded cached credentials.
Flushing log events to Clearcut.
[AgentRegistry] Initialized with 1 agents.
Flushing log events to Clearcut.
Session ID: 0330822d-e5e6-41a8-96e2-c4d7600aaa52

> /Users/jagman/gemini/wrgmtls/bin:/Users/jagman/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/jagman/go/bin:/Users/jagman/.local/bin:/Users/jagman/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/opt/X11/bin:/Library/TeX/texbin:/Applications/Little Snitch.app/Contents/Components


### Client information


* **CLI Version:** 0.9.0
* **Git Commit:** a93d92a3
* **Session ID:** 85b837e5-efa6-4aef-bf82-31d29b9ef74e
* **Operating System:** darwin v24.10.0
* **Sandbox Environment:** sandbox-exec (permissive-open)
* **Model Version:** gemini-2.5-pro
* **Memory Usage:** 356.3 MB


### Login information

Google Account

### Anything else we need to know?

First noticed problems with the new extensions which failed outside my ~/.gemini directory.  Uninstalled them all to remove errors they generated.  Simple test in interactive mode was to invoke a shell command: ! echo $PATH.  Above shows non-interactive mode with debug turned on to achieve same effect: errors under sandbox (-s), no errors without.

Labels: priority/p2
State: closed