claude-code - 💡(How to fix) Fix [BUG] Image paste (Alt+V) always fails under WSL when login shell is fish — clipboard command run via $SHELL, which rejects "$(...)" in command position

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

Code Example

"$(command -v powershell.exe 2>/dev/null || echo /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe)" \
    -NoProfile -NonInteractive -Sta \
    -Command 'Add-Type -AssemblyName System.Windows.Forms; if (-not [System.Windows.Forms.Clipboard]::ContainsImage()) { exit 1 }'

---

# Claude's UI toast:
No image found in clipboard. Use ctrl+v to paste image

# Reproducing the exact helper command Claude runs, under each shell:

$ fish -c '"$(command -v powershell.exe 2>/dev/null || echo /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe)" -NoProfile -NonInteractive -Sta -Command (...)'
fish: command substitutions not allowed in command position. Try var=(your-cmd) $var ...
# exit code: 127   <-- helper never runs; Claude concludes "no image"

$ /bin/sh -c '"$(command -v powershell.exe 2>/dev/null || echo /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe)" -NoProfile -NonInteractive -Sta -Command (...)'
# exit code: 0     <-- image detected correctly

# Proof the clipboard really holds an image (PowerShell via the same fallback path):
[System.Windows.Forms.Clipboard]::ContainsImage()  -> True
GetImage().Save(...)  -> valid PNG, 1019 x 322

# The login shell Claude inherits (from /proc/<claude-pid>/environ):
SHELL=/run/current-system/sw/bin/fish
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?

On WSL2 with fish as the login shell, pasting a clipboard image (Alt+V) in the Claude Code REPL always reports:

No image found in clipboard. Use ctrl+v to paste image

The clipboard genuinely contains an image. The failure is not in clipboard access or WSL interop — it is that Claude executes its clipboard helper command through the user's login shell ($SHELL), and that command uses POSIX command-substitution-in-command-position syntax that fish refuses to run.

The clipboard image detection/extraction command embedded in the bundle is:

"$(command -v powershell.exe 2>/dev/null || echo /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe)" \
    -NoProfile -NonInteractive -Sta \
    -Command 'Add-Type -AssemblyName System.Windows.Forms; if (-not [System.Windows.Forms.Clipboard]::ContainsImage()) { exit 1 }'

The leading "$(...)" is a command substitution in command position. POSIX shells accept it; fish does not, and aborts with exit code 127 before PowerShell is ever invoked. Claude interprets that failure as "no image in clipboard".

Notably, Claude's Bash tool already runs under bash (its shell snapshots are snapshot-bash-*.sh) — so only these auxiliary helper commands leak through to the raw login shell. Running the same helper under /bin/sh or bash works; only fish fails. The fix is to run these helper commands under /bin/sh (or bash) rather than $SHELL.

What Should Happen?

Pasting an image should detect and attach it regardless of the user's login shell. Claude's internal/auxiliary shell commands should be executed with a POSIX-compatible shell (e.g. /bin/sh), not the interactive login shell, since the commands are written in POSIX syntax that non-POSIX shells like fish cannot parse.

Error Messages/Logs

# Claude's UI toast:
No image found in clipboard. Use ctrl+v to paste image

# Reproducing the exact helper command Claude runs, under each shell:

$ fish -c '"$(command -v powershell.exe 2>/dev/null || echo /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe)" -NoProfile -NonInteractive -Sta -Command (...)'
fish: command substitutions not allowed in command position. Try var=(your-cmd) $var ...
# exit code: 127   <-- helper never runs; Claude concludes "no image"

$ /bin/sh -c '"$(command -v powershell.exe 2>/dev/null || echo /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe)" -NoProfile -NonInteractive -Sta -Command (...)'
# exit code: 0     <-- image detected correctly

# Proof the clipboard really holds an image (PowerShell via the same fallback path):
[System.Windows.Forms.Clipboard]::ContainsImage()  -> True
GetImage().Save(...)  -> valid PNG, 1019 x 322

# The login shell Claude inherits (from /proc/<claude-pid>/environ):
SHELL=/run/current-system/sw/bin/fish

Steps to Reproduce

  1. Use WSL2 with fish set as the login shell (echo $SHELL -> .../fish).
  2. Launch claude from that fish session.
  3. Take a screenshot on Windows (Win+Shift+S) so the Windows clipboard holds an image.
  4. Press Alt+V in the Claude Code prompt. -> Toast: "No image found in clipboard. Use ctrl+v to paste image"

Confirm the cause: 5. Quit, relaunch with a POSIX shell: env SHELL=/bin/bash claude 6. Press Ctrl+V on the same screenshot -> image attaches correctly.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

2.1.158 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

Environment

  • OS: NixOS-WSL on WSL2, kernel 6.6.114.1-microsoft-standard-WSL2
  • Terminal: Windows Terminal hosting the WSL distro
  • Login shell: fish (SHELL=/run/current-system/sw/bin/fish)
  • WSL interop enabled; /mnt/c mounted; powershell.exe reachable via the hardcoded fallback path. None of these are 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…

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 [BUG] Image paste (Alt+V) always fails under WSL when login shell is fish — clipboard command run via $SHELL, which rejects "$(...)" in command position