spawn pgrep ENOENT crash on macOS (regression in v2.1.91)

Resolved 💬 3 comments Opened Apr 4, 2026 by james-livefront Closed Apr 7, 2026

Bug description

Claude Code crashes with ENOENT: no such file or directory, posix_spawn 'pgrep' during normal operation (attempting to read a file via the Read tool). The crash dumps minified ink UI source to the terminal.

pgrep exists at /usr/bin/pgrep and is accessible from the user's shell. The issue appears to be that Bun's subprocess spawning uses a restricted PATH that doesn't include /usr/bin, or the ENOENT is not caught gracefully.

Prior issues

This was previously reported and closed:

  • #15026 (closed 2026-03-11)
  • #17626 (closed 2026-01-12)

The bug has regressed or was never fully fixed.

Reproduction steps

  1. Open Claude Code on macOS
  2. Ask it to read a file (triggers internal pgrep -P <pid> call)
  3. Crash occurs with ENOENT

Error output

ENOENT: no such file or directory, posix_spawn 'pgrep'
      path: "pgrep",
   syscall: "spawn pgrep",
     errno: -2,
 spawnargs: [ "-P", 10870 ],
      code: "ENOENT"

      at spawn (unknown:1:1)
      at spawn (node:child_process:667:35)
      at spawn (node:child_process:14:39)
      at /$bunfs/root/claude:814:4866
      at pRA (/$bunfs/root/claude:814:5359)
      at /$bunfs/root/claude:814:4837

Environment

  • Claude Code version: 2.1.91
  • OS: macOS Darwin 25.4.0
  • Shell: zsh
  • pgrep location: /usr/bin/pgrep (confirmed accessible)

Expected behavior

Claude Code should either:

  1. Use the full path /usr/bin/pgrep instead of relying on PATH resolution
  2. Catch the ENOENT and degrade gracefully instead of crashing

View original on GitHub ↗

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