claude-code - 💡(How to fix) Fix Code blocks have automatic indentation making commands un-copy-pasteable

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…

Root Cause

  1. Ask Claude Code to provide a shell command with JSON input
  2. Copy the command from the code block
  3. Paste into terminal
  4. The command fails because JSON has extra indentation/whitespace

Fix Action

Workaround

Use file-based input instead of inline JSON.

Code Example

ct temporal prod workflow start --input '{"foo":"bar"}'

---

ct temporal prod workflow start --input '{"foo":"bar"}'
RAW_BUFFERClick to expand / collapse

Bug Description

When Claude Code outputs code blocks (using triple backticks), the rendered output automatically adds 2-space indentation to every line. This makes commands un-copy-pasteable when they contain whitespace-sensitive content like JSON.

Steps to Reproduce

  1. Ask Claude Code to provide a shell command with JSON input
  2. Copy the command from the code block
  3. Paste into terminal
  4. The command fails because JSON has extra indentation/whitespace

Example

Claude outputs:

ct temporal prod workflow start --input '{"foo":"bar"}'

User copies and pastes, but it actually becomes:

  ct temporal prod workflow start --input '{"foo":"bar"}'

The 2-space indent breaks the command.

Expected Behavior

Code blocks should not have any automatic indentation added. Content should be copy-pasteable exactly as written.

Impact

This affects any workflow where users need to copy-paste commands with JSON, heredocs, or other whitespace-sensitive content. It's particularly problematic for infrastructure/DevOps workflows.

Workaround

Use file-based input instead of inline JSON.

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

claude-code - 💡(How to fix) Fix Code blocks have automatic indentation making commands un-copy-pasteable