Claude Code cannot read clipboard images without file extension (KDE Klipper incompatibility)
Bug Description
Claude Code refuses to read image files that have no file extension. This breaks compatibility with KDE Klipper (the standard KDE clipboard manager), which saves clipboard images as extensionless files.
Steps to Reproduce
- Copy an image to clipboard on KDE Plasma (e.g. screenshot, image from browser)
- Klipper saves it to a path like
/tmp/klipper-XXXXXX(no extension) - Try to pass that path to Claude Code (e.g. via a tool call or drag-and-drop)
- Claude Code refuses to read it / doesn't recognize it as an image
Expected Behavior
Claude Code should detect the file format using magic bytes (file header inspection), not the file extension. This is the standard and correct approach for binary format detection.
Example: PNG files always start with \x89PNG\r\n\x1a\n — this is deterministic and doesn't require an extension.
Actual Behavior
Claude Code relies on the file extension to identify image files. Extensionless files are rejected even when they are valid PNG/JPEG/WebP images.
Environment
- OS: Linux (Debian / KDE Plasma)
- Clipboard manager: Klipper (KDE default)
- Claude Code version: latest
Impact
This blocks all KDE users who try to share clipboard images with Claude Code, since Klipper is the default clipboard manager on KDE Plasma and saves images without extensions.
Suggested Fix
Detect image format from magic bytes when the file has no extension or an unrecognized extension:
PNG: starts with 89 50 4E 47 0D 0A 1A 0A
JPEG: starts with FF D8 FF
GIF: starts with 47 49 46 38
WebP: starts with 52 49 46 46 ... 57 45 42 50
BMP: starts with 42 4D
This is standard practice (libmagic, Python's imghdr, Node's file-type package, etc.).
Workaround (painful)
# User must manually copy and rename the file with the correct extension
cp /tmp/klipper-XXXXXX /tmp/image.png
# Then pass /tmp/image.png to Claude Code
This is a poor UX that should not be required.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗