[BUG] Copying long commands from chat UI inserts hidden characters that break terminal execution on macOS

Resolved 💬 2 comments Opened Apr 16, 2026 by ArielSmoliar Closed Apr 19, 2026

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?

[Important]: claude.ai web UI bug, not a Claude Code CLI bug

Background: Doing exploration with Google Cloud and Datadog agents, a product manager and not hardcore infra expert

Environment: macOS (Apple Silicon, arm64), zsh shell, copying commands from the Claude.ai chat UI in a browser

The problem: When Claude outputs long terminal commands in code blocks, copying them from the chat UI and pasting into the terminal inserts invisible characters at line-wrap points. The shell interprets these as line breaks, splitting a single command into multiple tokens. This causes errors like flag needs an argument: 'f' in -f, zsh: command not found: --set, or zsh: permission denied: <path>, even when the command is syntactically correct.__

What Should Happen?

Impact: This is particularly harmful for non-technical users following step-by-step CLI guidance. The error looks like user error but is caused by the copy mechanism. It required manually retyping commands or breaking them into shorter pieces to work around, adding significant friction across multiple steps.

Error Messages/Logs

**Example:** The command helm install datadog-agent datadog/datadog -n datadog -f ~/path/to/values.yaml was split after -f, causing zsh to treat the file path as a separate command and return Error: flag needs an argument: 'f' in -f and zsh: permission denied:  ~/path/to/values.yaml.

Steps to Reproduce

  1. Open Claude.ai in a browser on macOS (Apple Silicon, zsh shell)
  2. Ask Claude to help with a DevOps or cloud infrastructure task that requires long terminal commands (e.g. installing a Helm chart, running a gcloud command with multiple flags)
  3. Claude responds with a command in a code block that is long enough to visually wrap onto a second line in the UI, for example: helm install datadog-agent datadog/datadog -n datadog -f ~/Testing-app/ecommerce-k8s-datadog/helm/datadog-values.yaml
  4. Click to copy the code block using the copy button (or manually select and copy)
  5. Paste the command into a macOS Terminal (zsh)
  6. Press Enter

Expected result: The command runs as a single line

Actual result: The shell splits the command at the visual line-wrap point, treating the second half as a separate command. Example errors produced:

  • Error: flag needs an argument: 'f' in -f
  • zsh: permission denied: ~/Testing-app/ecommerce-k8s-datadog/helm/datadog-values.yaml
  • zsh: command not found: --set

_Note: The issue does not occur when the command is short enough to fit on one line in the UI, or when the user manually types the command instead of copying it._

Claude Model

Sonnet (default)

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Claude Sonnet 4.6

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

_No response_

View original on GitHub ↗

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