[BUG] `-p` mode always hallucinates image content when Read tool returns image data, interactive mode does not
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using -p (print/headless) mode, the model consistently fabricates/hallucinates
image content when the Read tool is used on image files (e.g., PNG).
Tested 20+ times in -p mode — 100% hallucination rate (model invents detailed
descriptions of the image).
Tested 40+ times in interactive mode with the exact same image — 0% hallucination
rate (model correctly reports it cannot see the image content).
The simplest reproduction:
claude -p --dangerously-skip-permissions "Read FIGURE.png in desktop,check out what it is?"
The model will confidently describe the image with fabricated details (e.g., claiming
it's a "data flow diagram" or "client-server architecture" with specific elements that
don't exist in the actual image).
In interactive mode, the same prompt correctly produces:
tool read the file but did not return visual content
What Should Happen?
The model in -p mode should behave the same as interactive mode — honestly report
that it cannot see/parse the image content, rather than fabricating a description.
Error Messages/Logs
No errors — the model returns a 200 OK response with fabricated content.
Example `-p` mode output:
$ claude -p --dangerously-skip-permissions "Read ~/Desktop/FIGURE.png and describe it"
> This image is a **flowchart/architecture diagram** showing a data processing
> or system interaction flow. The diagram contains the following main elements:
> 1. On the left side, there is a box labeled **"Client"**
> 2. In the middle, there are multiple processing steps connected by arrows
> 3. On the right side, there is a box labeled **"Server"**
> ...
All of the above is fabricated. The actual image content bears no resemblance
to any of the descriptions produced.
Example interactive mode output (same image, same machine):
> The tool read the file but did not return visual content.
> The file exists (~20KB, created January 18, 2025).
> Unfortunately, the Read tool was unable to return the image data.
Steps to Reproduce
- Place any PNG image on the desktop (e.g., FIGURE.png, ~20KB)
- Run in interactive mode:
$ claude
> Read ~/Desktop/FIGURE.png and describe what's in it
→ Model correctly reports it cannot see the image (0% hallucination, tested 40 times)
- Run in -p mode:
$ claude -p --dangerously-skip-permissions "Read ~/Desktop/FIGURE.png and describe what's in it"
→ Model fabricates image content (100% hallucination, tested 20 times)
- Repeat steps 2-3 to confirm consistency
Note: --dangerously-skip-permissions is not required to reproduce —
the hallucination occurs with just -p alone. The flag is included
only to skip the permission prompt for easier testing.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
OPUS 4-6
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
- Adding an anti-hallucination instruction via --append-system-prompt partially
mitigates the issue — the model sometimes starts fabricating, then self-corrects
mid-response. However, this is unreliable and not a proper fix.
- The issue is not related to any wrapper/UI — it reproduces with bare
claude -p directly in CMD.
- Both modes use the same CLI binary, same model, same machine. The only
difference is -p flag vs interactive mode.
- Tested with various image files — the hallucination is not specific to
one particular image.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗