claude-code - 💡(How to fix) Fix [BUG] "Run in terminal" strips ALL spaces from commands; arrow only renders on bash-tagged blocks

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…

Error Message

Error Messages/Logs

Root Cause

Ask Claude for any shell command, e.g. echo hello or echo "a b c" The code block shows the correct command Click the ▷ Run-in-terminal button The gray preview line below the button shows the command with all spaces removed, including spaces inside quoted strings Terminal window flashes briefly but nothing is executed (because the squashed command is invalid) Examples observed:

Fix Action

Fix / Workaround

Workaround (for both): Click 📋 Copy and paste manually into the terminal with Cmd+V. Copy preserves spaces correctly, so the bug appears to be specific to the run-in-terminal pipeline.

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?

Hi Anthropic team,

I found two related bugs in Claude for Mac (version 1.6608.0, build f65729) on macOS, zsh shell.

Bug 1 — Run-in-terminal button strips all spaces from the command before sending

Steps to reproduce:

Ask Claude for any shell command, e.g. echo hello or echo "a b c" The code block shows the correct command Click the ▷ Run-in-terminal button The gray preview line below the button shows the command with all spaces removed, including spaces inside quoted strings Terminal window flashes briefly but nothing is executed (because the squashed command is invalid) Examples observed:

Code block: echo hello → preview: echohello Code block: echo "a b c" → preview: echo"abc" Note that the second case strips spaces inside the quoted string, which would change the semantics even if the command did execute. Screenshots attached.

Expected: The preview line and the command sent to the terminal should be byte-identical to the code block content.

Bug 2 — Run arrow only appears on code blocks with explicit bash/shell language tag

If a code block is rendered without a language tag (just plain triple-backticks), the ▷ Run button does not appear at all — only the 📋 Copy icon shows. The same command in a code block tagged ```bash gets the Run button. This isn't documented anywhere I could find, and from a UX perspective it's confusing — Claude often produces commands without an explicit language tag.

Workaround (for both): Click 📋 Copy and paste manually into the terminal with Cmd+V. Copy preserves spaces correctly, so the bug appears to be specific to the run-in-terminal pipeline.

Environment:

Claude for Mac version 1.6608.0 (f65729) macOS [your version — najdi v About This Mac] Shell: zsh, Terminal.app Happy to provide any further info or diagnostics. Thanks for the great product!

Best regards, Peter Hruska

What Should Happen?

When I click the ▷ "Run in terminal" button on a code block, the exact command shown in the code block should be sent to my terminal — byte-for-byte identical, with all spaces preserved (both between arguments and inside quoted strings). The terminal should then execute the command normally.

Additionally, the ▷ Run button should appear consistently on all shell-command code blocks, not only on those explicitly tagged as ```bash.

Error Messages/Logs

Steps to Reproduce

When I click the ▷ "Run in terminal" button on a code block, the exact command shown in the code block should be sent to my terminal — byte-for-byte identical, with all spaces preserved (both between arguments and inside quoted strings). The terminal should then execute the command normally.

Additionally, the ▷ Run button should appear consistently on all shell-command code blocks, not only on those explicitly tagged as ```bash.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

Version 1.6608.0 (f65729)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

<img width="507" height="120" alt="Image" src="https://github.com/user-attachments/assets/0e132a8b-c478-4a92-8c85-5e27fe0201b2" /> <img width="525" height="118" alt="Image" src="https://github.com/user-attachments/assets/9368ee6c-0c33-42d0-a2e3-94fcdca6cf8d" />

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