[BUG] Claude Code in Desktop App silently fails — `shellPathWorker.js` crashes on `electron.app.isPackaged` (macOS 26.3.1, M4 Pro)
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?
[BUG] Claude Code in Desktop App silently fails — shellPathWorker.js crashes on electron.app.isPackaged (macOS 26.3.1, M4 Pro)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
Environment
- App Version: 1.2.234 (2d1855)
- Bundled Claude Code: 2.1.87
- CLI Claude Code: 2.1.89 (works fine)
- Platform: macOS 26.3.1 (Darwin 25.3.0)
- Chip: Apple M4 Pro
- Node (Electron): 24.14.0
What's Wrong?
Claude Code in the desktop app silently fails on every session — the process exits with code 1 immediately, before producing any response. Regular chat works fine. Claude Code in the terminal works fine.
Root Cause
The shellPathWorker.js utility process crashes at startup with:
/Applications/Claude.app/Contents/Resources/app.asar/.vite/build/shell-path-worker/shellPathWorker.js:13036
if (!electron.app.isPackaged && false) ;
^
TypeError: Cannot read properties of undefined (reading 'isPackaged')
electron.app is undefined in the utility process context. The worker crashes, shell environment extraction fails, and the desktop app falls back to a bare process.env that lacks auth credentials. The spawned Claude Code binary then exits with "Not logged in" (exit code 1).
Crash Chain
- Desktop app launches
shellPathWorker.jsas a utility process - Worker references
electron.app.isPackaged→electron.appisundefined→ TypeError crash - Desktop app logs:
[CCD] Shell environment extraction failed, using process.env: Error: Utility process exited with code: 1 - Desktop app spawns Claude Code binary with bare Electron
process.env(missing shell PATH, auth context, etc.) - Bundled binary (
2.1.87) can't authenticate → exits with code 1 ("Not logged in") - Desktop app logs:
Session <id> query error: Claude Code process exited with code 1 - UI shows nothing — silent failure, no error message to the user
Evidence
The bundled binary works fine when run manually with a full shell environment:
cd ~/my-project && \
"~/Library/Application Support/Claude/claude-code/2.1.87/claude.app/Contents/MacOS/claude" \
-p "hello" 2>&1
# Output: Hello! How can I help you today?
The bundled binary fails with a stripped environment (simulating the fallback):
cd ~/my-project && \
env -i HOME="$HOME" PATH="/usr/bin:/bin:/usr/sbin:/sbin" \
"~/Library/Application Support/Claude/claude-code/2.1.87/claude.app/Contents/MacOS/claude" \
-p "hello" 2>&1
# Output: Not logged in · Please run /login
Launching the desktop app from terminal exposes the crash directly:
/Applications/Claude.app/Contents/MacOS/Claude
# Output includes:
# shellPathWorker.js:13036
# if (!electron.app.isPackaged && false) ;
# ^
# TypeError: Cannot read properties of undefined (reading 'isPackaged')
Steps to Reproduce
- Install Claude Desktop v1.2.234 on macOS 26.3.1 (Apple Silicon)
- Open the app normally (from Dock/Launchpad)
- Switch to Claude Code mode
- Select a project directory and send any message
- Observe: no response, no error in UI — silent failure
- Check
~/Library/Logs/Claude/main.log— seeShell environment extraction failedwarning andClaude Code process exited with code 1errors
What Was Tried
- ⌘Q and relaunch → same failure
- Full macOS restart → same failure
- Fresh download and reinstall of Claude Desktop → same failure
- OS software update (macOS 26.3.1) + restart → same failure
- Disabling all plugins and MCP connections → same failure (still crashes with just 1 skills plugin)
- Launching desktop app from terminal → shell worker still crashes, Claude Code still fails
Expected Behavior
Claude Code sessions in the desktop app should start successfully. The shellPathWorker.js should handle the utility process context where electron.app may be undefined.
Related Issues
- #39270 — Same symptoms (macOS Apple Silicon, exit code 1, binary works in terminal but crashes when spawned by desktop app), but root cause was not identified. That report attributed the issue to the March 25 Anthropic outage and a CSP violation. This issue identifies the actual crash site (
shellPathWorker.js:13036) and the full failure chain. - #22559 — Documents the underlying architecture: the desktop app constructs a custom environment for CLI subprocesses, extracting only PATH via a utility process and dropping all other environment variables. When the utility process crashes (as in this bug), the subprocess gets a bare environment with no auth context.
Suggested Fix
The worker at shellPathWorker.js:13036 should guard against electron.app being undefined:
// Instead of:
if (!electron.app.isPackaged && false) ;
// Something like:
if (electron.app && !electron.app.isPackaged && false) ;
Or more broadly, the shell environment extraction should be resilient to this failure — either by retrying with a different strategy or by ensuring the fallback process.env still includes enough context for the spawned Claude Code binary to authenticate via the desktop app's cached OAuth tokens.
What Should Happen?
When I open Claude Code in the desktop app and send a message, it should respond — the same way it does when I run it from the terminal. If something goes wrong internally, the app should show me an error message instead of silently swallowing the failure.
Error Messages/Logs
Here's a concise set of the key log entries:
# Shell environment extraction crash (visible when launching from terminal):
/Applications/Claude.app/Contents/Resources/app.asar/.vite/build/shell-path-worker/shellPathWorker.js:13036
if (!electron.app.isPackaged && false) ;
^
TypeError: Cannot read properties of undefined (reading 'isPackaged')
# Desktop app log (~/Library/Logs/Claude/main.log) on startup:
[warn] [CCD] Shell environment extraction failed, using process.env: Error: Utility process exited with code: 1
# Desktop app log on every Claude Code session attempt:
[error] Session local_XXXX query error: Claude Code process exited with code 1
[info] [CCD CycleHealth] unhealthy cycle for local_XXXX (1s, hadFirstResponse=false, reason=no_response)
# Bundled binary with stripped env (simulating the fallback):
$ env -i HOME="$HOME" PATH="/usr/bin:/bin:/usr/sbin:/sbin" \
"~/Library/Application Support/Claude/claude-code/2.1.87/claude.app/Contents/MacOS/claude" \
-p "hello"
> Not logged in · Please run /login
Steps to Reproduce
1. Install Claude Desktop v1.2.234 on macOS 26.3.1 (Apple Silicon)
2. Open the app normally (from Dock or Launchpad)
3. Switch to Claude Code mode and select any project directory
4. Send any message (e.g., "hello")
5. Observe: no response appears, no error shown in UI
6. Confirm the crash in logs: tail ~/Library/Logs/Claude/main.log
- Look for: "[CCD] Shell environment extraction failed"
- Look for: "Claude Code process exited with code 1"
7. Confirm the underlying TypeError by launching from terminal:
/Applications/Claude.app/Contents/MacOS/Claude
- Output will include: shellPathWorker.js:13036 TypeError: Cannot read properties of undefined (reading 'isPackaged')
8. Confirm the bundled binary itself is fine:
"~/Library/Application Support/Claude/claude-code/2.1.87/claude.app/Contents/MacOS/claude" -p "hello"
- Output: "Hello! How can I help you today?"
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Claude 1.2.234 (2d1855) 2026-04-01T07:58:22.000Z
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Other
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗