Pasting an unresolvable image-extension path hangs input on "Pasting…" indefinitely (regression; ~ no longer expanded)
Summary
When I paste a text string that ends in an image extension (e.g. .png), Claude Code tries to load that path as an image attachment. If the path resolves to a real file, it attaches fine. But if the path can't be resolved — a bare filename, or a ~/… path (tilde is not expanded) — the input hangs on "Pasting…" forever instead of failing gracefully. While hung, the Enter key stops submitting (the stuck paste swallows keystrokes); only Ctrl-C recovers.
This used to work: pasting a ~/path/to/file.png path previously resolved and behaved normally. It now hangs, so this is a regression.
Environment
- Claude Code running on a remote Linux host over SSH; reproduced on 2.1.205 and 2.1.215 (so not specific to the latest version).
- Renderer:
default(tui: default). - Terminal client: Ghostty 1.3.1 on macOS.
TERM=xterm-ghostty; the remote host has thexterm-ghosttyterminfo installed. Reproduced from two different client machines.
Steps to reproduce
- Put a string ending in
.pngthat does not point to an existing file on the clipboard — e.g.probe_12.00.00_PM.png(bare filename), or~/tmp/probe.png(tilde path;~isn't expanded so it won't resolve). - Paste it into the Claude Code prompt.
- Input hangs on "Pasting…" indefinitely. Enter no longer submits.
Ctrl-Cto recover.
Controlled comparison (isolates the trigger)
| Pasted string | Result |
|---|---|
| probe_12.00.00_PM.txt | ✅ inserts as text |
| probe_12.00.00_PM.png (identical but .png) | ❌ hangs on "Pasting…" |
| probe_12.00.00_PM.png (trailing space) | ❌ still hangs (detection scans whole paste) |
| /absolute/path/to/real.png (exists) | ✅ attaches image, no hang |
So the trigger is: paste contains an image extension AND the path does not resolve to an existing file.
Expected behavior
An unresolvable image-extension path should be inserted as literal text (or produce an immediate error). It should never hang the input loop, and it must never block the Enter key.
Suggested fixes
- Expand
~before attempting to resolve a pasted image path (restores the prior behavior). - If the file doesn't exist / can't be read, fall back to inserting the literal text instead of waiting.
- Add a timeout to the image-load path so a failed resolution can't wedge the prompt.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗