[BUG] Pasting a text file path with an image extension discards the path: model receives only [Image #N], never the text

Status Open
Reported on v2.1.252
Maintainer reply None cached
Activity 0 comments · opened Sep 1, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

Pasting a plain-text file path that happens to end in an image extension (e.g. /home/me/assets/logo.png) into the interactive prompt silently replaces the text with an [Image #N] chip. The message that reaches the model contains only [Image #N] plus the image bytes — the path string is gone.

The clipboard held text, not an image. The user's input is destroyed without any indication, and the task the path was needed for ("put this path into the config / src attribute") cannot be done because the model never sees the path.

This is filed as a bug, not a feature request: #15597 / #73813 / #79486 ask for an option to paste as text. The defect here is that a paste discards the pasted data. Text in the clipboard must be pasted as text. Only real image (binary) clipboard data should become an attachment.

What Should Happen?

A clipboard containing a string is inserted as that string, unchanged — the same as every other terminal program. Image attachment happens only when the clipboard contains image data.

At minimum, if path-to-image conversion is kept, the path text must remain in the message next to the chip so no input is lost.

Error Messages/Logs

No error is shown. Evidence from session transcripts (~/.claude/projects/*/*.jsonl): every user message carrying an image block has text of the form [Image #N] ...typed words...; no message contains the pasted path.

Print mode does not have the problem — the text survives and the image is attached in addition:

$ echo "Reply with exactly the text between the markers. <<< /abs/path/pic.png >>>" | claude -p
/abs/path/pic.png

So the data loss is specific to the interactive input's paste handling.

Steps to Reproduce

  1. Have an existing image file, e.g. /home/me/assets/logo.png.
  2. Copy that path as text (echo -n /home/me/assets/logo.png | xclip -selection clipboard, or select it in an editor and copy).
  3. In interactive claude, paste with Ctrl+V and type: set this as the src of the header image.
  4. Send.

Actual: input shows [Image #1] set this as the src of the header image; the model receives [Image #1] + image block, no path, and asks what the path is or guesses.
Expected: input shows /home/me/assets/logo.png set this as the src of the header image.

Notes on the trigger (tested): absolute or ./-relative path, image extension, file exists. Wrapping in quotes or backticks or adding trailing whitespace does not prevent conversion. A bare relative path (assets/logo.png) or a non-existent path is left as text — which is why the workarounds in #15597 (delete last character, make relative) work.

Claude Model

Default

Is this a regression?

Not sure

Last Working Version

_No response_

Claude Code Version

2.1.252

Platform

CLI

Operating System

Linux (Debian, kernel 7.1.3)

Terminal/Shell

gnome-terminal / bash

Additional Information

Related feature-request issues: #15597, #73813, #79486. Those propose settings/keybindings; this report is about the current default destroying pasted text.

View original on GitHub ↗