anthropics / anthropics/claude-code

Desktop app: Run button on a bash code block always fails with "Failed to send the command result to Claude"

Open
#94,849 0 comments 0 reactions 0 assignees View on GitHub
area:desktop bug has repro platform:macos
Dominant language
Python
Stars
145k
Forks
23.1k
PR merge metrics
PR metrics pending

Description

## Environment

- Claude desktop app 2.110.0 (macOS, Apple Silicon, Darwin 25.6.0)
- App-managed CLI: 2.1.271
- Login shell: `/bin/bash` (macOS system bash 3.2.57(1)-release), set via `chsh`
- Locale: fr-FR
- Started with the 2026-09-15 app update. Was working before.

## Symptom

Clicking **Run** on a bash code block in the Code tab:

- the command **does run** in the Terminal panel tab, output is visible there
- an inline output box appears under the code block in the chat
- a toast fires every single time: *"Failed to send the command result to Claude. Check the terminal tab."* (fr: "Impossible d'envoyer le résultat de la commande à Claude. Vérifiez l'onglet du terminal.")
- nothing reaches the conversation

100% reproducible, with a command as trivial as `echo test-$(date +%s)`.

## Root cause

The app's OSC 133 shell integration is never installed in the terminal PTYs, so the app has no command-start/command-end marks and cannot delimit the output it is supposed to send back.

### Evidence

1. Terminal tabs are spawned as plain `/bin/bash -l`, with no `--init-file`:

```
$ ps -eo pid,ppid,command | grep 'bin/bash -l'
46935 46928 /bin/bash -l
47776 46928 /bin/bash -l
...
$ ps -p 46928 -o command
/Applications/Claude.app/Contents/Frameworks/Claude Helper.app/Contents/MacOS/Claude Helper --type=utility --utility-sub-type=node.mojom.NodeService ...
```

Per `Te()` in the bundle, a bash shell invoked with args exactly `["-l"]` should be re-spawned as `["--init-file", /bash/]`. It is not.

2. Inside a freshly opened terminal tab:

```
PC=[rename_tab] # PROMPT_COMMAND, not wrapped by __claude_desktop_precmd / __claude_desktop_arm
ARM=no # declare -F __claude_desktop_arm -> not found
NONCE= # __claude_desktop_nonce empty
SHELL=/bin/bash BASH=3.2.57(1)-release
```

3. The integration directory is never created:

```
$ ls -d ~/Library/Application\ Support/Claude/terminal-shell-integration
ls: ...: No such file or directory
$ ls -d ~/Library/Application\ Support/Claude/terminal-scrollback
ls: ...: No such file or directory
```

A full-disk search for files containing `__claude_desktop_arm` or `__claude_desktop_precmd` returns nothing, so `Ee(r.dir)` has never run.

4. In `app.asar`, the gate is:

```js
shellIntegration: {
dir: join(this.userDataPath, "terminal-shell-integration"),
enabled: () => lF("4044603026")
}
...
async shellIntegrationForSpawn(e, n) {
let r = this.config.shellIntegration;
if (!r || this.quitting || !r.enabled() || !we(e.shell)) return;
this.shellIntegrationDirReady ??= Ee(r.dir)...
}
```

`we("/bin/bash")` returns `"bash"` and the args are exactly `["-l"]`, so both of those checks pass. The directory is never created, which means the gate returns before `Ee(r.dir)`. That leaves `!r` or `!r.enabled()`, i.e. feature flag `4044603026` resolving false on this install.

Nothing in the log files records this. `main.log` has no `[ShellPtyManager]` or `shell_integration` entry, and the toast itself is renderer-side and leaves no trace in `claude.ai-web.log`.

## Ruled out

- **User `PROMPT_COMMAND`.** `a sourced shell script of mine` sets `PROMPT_COMMAND='rename_tab'`, but the integration script sources the user's dotfiles first and then wraps whatever it finds, so this would not break it.
- **bash 3.2.** The integration script explicitly handles pre-5.1 bash (string form of `PROMPT_COMMAND`, DEBUG trap instead of bash-preexec).
- **Renderer reload.** One `Loaded https://claude.ai` happened mid-test, but runs before and after it failed identically.

## What would help

Either ship the integration to this install, or make the Run button degrade gracefully when no marks are available (capture the visible output, or disable the Run button) instead of running the command and then failing to deliver the result with a toast the user can do nothing about.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the desktop terminal PTY spawn path and shellIntegrationForSpawn described in the issue, then reproduce with a fresh bash -l terminal and the Code tab Run button. Verify why the shell integration directory and init file are not installed, and confirm that command results reach the conversation or that Run fails gracefully when marks are unavailable.

Written by the indexing model from the issue text.

Assessment

Tech stack
bash, macos
Domain
cli, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.