claude-code - 💡(How to fix) Fix Leading whitespace before slash commands is no longer stripped — command text sent as message instead [1 participants]

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…
GitHub stats
anthropics/claude-code#52903Fetched 2026-04-25 06:17:47
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Lines starting with whitespace followed by a slash command (e.g. /plugin uninstall foo) are no longer recognized as slash commands. They're being sent to the model as regular chat messages. Previously, Claude Code stripped leading whitespace before matching against /, so commands pasted from external sources or copied with indentation still worked as commands. This is a regression — observed on 2026-04-24.

Root Cause

Lines starting with whitespace followed by a slash command (e.g. /plugin uninstall foo) are no longer recognized as slash commands. They're being sent to the model as regular chat messages. Previously, Claude Code stripped leading whitespace before matching against /, so commands pasted from external sources or copied with indentation still worked as commands. This is a regression — observed on 2026-04-24.

Fix Action

Workaround

Manually remove leading whitespace before / before pressing Enter.

Code Example

/plugin uninstall standard-tooling@standard-tooling-marketplace

I'll wait — that's a command you're running, not a request for me. Let me know when you want me to do something.

   /plugin uninstall standard-tooling@standard-tooling-marketplace

/plugin is a built-in Claude Code command you run yourself in the CLII can't invoke it for you. Type that line at the prompt (not in a message to me) and Claude Code will uninstall the plugin.
RAW_BUFFERClick to expand / collapse

Version: Claude Code v2.1.119, Opus 4.7 (1M context), Claude Max

Summary

Lines starting with whitespace followed by a slash command (e.g. /plugin uninstall foo) are no longer recognized as slash commands. They're being sent to the model as regular chat messages. Previously, Claude Code stripped leading whitespace before matching against /, so commands pasted from external sources or copied with indentation still worked as commands. This is a regression — observed on 2026-04-24.

Reproduction

  1. Start a Claude Code CLI session.
  2. At the prompt, type or paste: ␣␣/plugin (two spaces followed by /plugin).
  3. Observe: the message is sent to the model instead of opening the /plugin UI.

Expected behavior

Leading whitespace before a slash-command token is stripped; the command is recognized and invoked by Claude Code itself.

Actual behavior

The leading whitespace prevents slash-command recognition; the text is sent to the model as a chat message. The model's response (something like "I can't invoke slash commands for you — type that line at the prompt") is just a downstream effect of the command not being intercepted by the CLI at all.

Example transcript

❯   /plugin uninstall standard-tooling@standard-tooling-marketplace

⏺ I'll wait — that's a command you're running, not a request for me. Let me know when you want me to do something.

❯   /plugin uninstall standard-tooling@standard-tooling-marketplace

⏺ /plugin is a built-in Claude Code command you run yourself in the CLI — I can't invoke it for you. Type that line at the prompt (not in a message to me) and Claude Code will uninstall the plugin.

Impact

Copy-paste workflows that include indentation (run books, step-by-step guides in markdown, previous transcripts where the command appeared in a bulleted or indented block) now silently send the command as a message instead of executing it. Wasted round-trips and confusion about whether the command was accepted.

Regression

This worked historically — pasting commands with leading whitespace from research-run transcripts was routine. The behavior change is recent.

Workaround

Manually remove leading whitespace before / before pressing Enter.

extent analysis

TL;DR

Remove leading whitespace before slash commands to ensure they are recognized by Claude Code.

Guidance

  • Verify that the issue is resolved by checking if the slash command is executed correctly after removing leading whitespace.
  • To mitigate the issue, update copy-paste workflows to strip leading whitespace from commands before executing them.
  • Consider modifying the Claude Code CLI to strip leading whitespace from input lines starting with a slash command.
  • Test the workaround by pasting a command with leading whitespace, removing the whitespace, and verifying that the command is executed correctly.

Example

No code snippet is provided as it is not clearly supported by the issue.

Notes

The provided workaround is a temporary solution, and a more permanent fix would involve modifying the Claude Code CLI to handle leading whitespace.

Recommendation

Apply workaround: Manually remove leading whitespace before / before pressing Enter, as this is a simple and effective solution to the problem.

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…

FAQ

Expected behavior

Leading whitespace before a slash-command token is stripped; the command is recognized and invoked by Claude Code itself.

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 Leading whitespace before slash commands is no longer stripped — command text sent as message instead [1 participants]