[MODEL] Claude Code CLI: Opus 4.8 hallucinating tool calls, user messages, and system prompts

Status Open
Maintainer reply None cached
Activity 9 comments · opened Jul 14, 2026

Preflight Checklist

  • [x] I have searched existing issues for similar behavior reports
  • [x] This report does NOT contain sensitive information (API keys, passwords, etc.)

Type of Behavior Issue

Other unexpected behavior

What You Asked Claude to Do

Just like any other day.

What Claude Actually Did

Claude spent up to 10 minutes "thinking."
Claude claimed to have completed the task, but in reality, it had only rehearsed it during the thought process.
Claude carried out actual actions based on a new user message that did not exist.

Expected Behavior

Claude should carry out tasks as usual.

Files Affected

There are currently no severely affected files.

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

Have Claude Opus 4.8 thoroughly explore and analyze this working directory, then present its findings.
Launch Opus 4.8 just as you would a standard sub-agent.

Claude Model

Opus

Relevant Conversation

Impact

High - Significant unwanted changes

Claude Code Version

v2.1.179, v2.1.199, v2.1.200, v2.1.201, v2.1.207

Platform

Anthropic API

Additional Context

To summarize the issue up front: recently, Claude Opus 4.8 running in the Claude Code CLI has been hallucinating tool calls and tool results that never happened, as well as fabricating user messages and system messages, and then treating them as fact while it continues working. I'm running into this more and more often. At best it stalls my day-to-day work; at worst, the model could make unexpected, destructive changes based on an "instruction" I never gave. I'd like to confirm whether this is a known issue, and — once confirmed — I hope you can fix it as soon as possible.

My environment:

  • Windows 11, Claude Code CLI, Claude Max 20x subscription
  • The raw logs I've collected cover v2.1.179, v2.1.199, v2.1.200, v2.1.201, and v2.1.207
  • Every affected session and subagent was running Claude Opus 4.8 (late-stage Opus 4.7 showed related symptoms earlier as well). I originally assumed Claude Fable 5 had the same problem, but after re-reviewing all of the raw logs I could not find a single instance on Fable 5 — in my records, Fable 5 only ever appears as the parent session, and it never exhibited any of these behaviors. So my current read is that the problem may be concentrated in Opus 4.8
  • The v2.1.207 release notes mention a fix for tool hints "being mistaken by the AI for system injections," but I still hit similar behavior on that version
  • I've tried a different machine and the same things still occasionally happen there, which largely rules out local injection or compromise on my end

The symptoms fall into four categories:

A. Tool calls emitted as plain text and failing to parse

This was the earliest category to appear. It wasn't present when Opus 4.7 first launched; it only began occurring sporadically later, in longer contexts (roughly past 200K tokens), and at the time there were many similar user reports on GitHub. This category has clearly eased off recently — it's now hard to reproduce — so you may have already fixed it. I'm recording it here only as background.

B. Extended continuous thinking, with hallucinated tool calls and results inside the chain of thought

The most striking case (an Opus 4.8 main session): I asked it to thoroughly explore a repository and give me an overview. After genuinely issuing a few tool calls, it then thought continuously for about 67 minutes. The raw log shows four consecutive thinking messages in that turn, each hitting the 64,000 output-token cap, until the turn finally aborted for exceeding the output limit. The thinking is full of statements like "I called the tool," "the tool output is empty, it might be broken," "let me try calling it a different way," "still not working" — yet none of those tool calls were ever actually issued, and the corresponding results simply do not exist. In other words, it fabricated the calls and their results inside its own thinking, believed it had really made them, and burned through four full output budgets in a row. The milder version I see in daily use is that it suddenly thinks for around 10 minutes without producing any output.

C. Hallucinating fake user messages and replying to them

This is the category that affects me most. The symptom is that it suddenly gives non-sequitur, incoherent replies, as if it were answering a third person: I ask it to do something, it doesn't, and instead it responds to someone who doesn't exist. Only after expanding the thinking summaries did I confirm what was happening: in its chain of thought it believes the user has replied, and then proceeds according to a user message it invented itself. These fabricated messages mimic my tone and mimic content plausible for the current context, so I don't think this is mechanical external prompt injection — it looks much more like hallucination.

I ran an experiment on this: I agreed on a codeword with it, wrapping everything I actually typed in an XML tag containing my name, so it could distinguish real messages from injected ones. It went reasonably well at first, but later it stopped complying again. When I asked why, it said the "virtual user messages" had also started arriving wrapped in the same XML tag with my name.

One case with more serious consequences: after a subagent (running Opus 4.8) hallucinated a fake user instruction, it claimed it had added the Python directory to the user's PATH environment variable. When I checked the raw logs afterward, it had never issued a real write tool call, and the parent session's follow-up verification found no persisted changes either — meaning it never actually touched the registry or PATH, yet it reported the fake user instruction, the tool call, and the successful result all as fact.

I also noticed another detail: it sometimes writes out a complete reply body inside its chain of thought, and then immediately says "the user replied ..., so I ...". That is, without ever actually sending the reply or waiting for my next message, it writes my answer on my behalf and keeps thinking from there.

(Quite a few other users have recently hit this same category and filed issues on GitHub.)

D. Hallucinated system prompts and hidden injected prompts

This is new within the last week. It actually calls tools normally, but then claims the tool is broken, that the tool output contradicts itself, that the tool output contains an injected prompt, or that it has received a system injection. For now this category doesn't disrupt work too badly — it still manages to push through the task — so I haven't dug into it deeply, but it still seems worth investigating.

On frequency: the early problem cases (including the 67-minute thinking incident above) all occurred in main sessions with Opus 4.8 as the primary model. Roughly estimating from my experience over the past week: spin up 4 Opus 4.8 subagents and about 1 will hit a tool-failure-type problem; spin up 30 and about 1 will start hallucinating fake user messages; the Fable 5 parent sessions have shown none of these behaviors so far.

Timeline in brief: a few weeks before Opus 4.8 shipped, category A started appearing on Opus 4.7; around mid-to-late June 2026, category B appeared; category C then became increasingly frequent; and category D is new within the last week. Notably, the same model shows an "absent early on, gradually appearing later" pattern, and the problem seems concentrated in one specific model, so I suspect this is more likely a server-side issue or something in that model's inference pipeline rather than a problem with the model weights themselves — though that's only my guess.

As for the cause, I have one more guess (for whatever it's worth): it may be related to interleaved thinking, or it may be a new problem introduced by overcorrecting while fixing category A. I keep seeing the same pattern in the chain of thought: at the exact point where it should have emitted a tool call or a reply, it doesn't stop — it gets "pushed" into continuing to think. It's expecting tool output, but instead it just keeps thinking; it finishes writing its reply to me, but never actually sends it, and instead starts guessing how I would respond, then keeps thinking. It looks as if some mechanism is forcing it to keep thinking, preventing it from stopping where it should — and since the model was never trained for that situation, it starts hallucinating. (I don't think I've hit any of these problems on the web interface, and I've noticed the web interface doesn't appear to use interleaved thinking.)

The practical impact on me: because subagents run Opus 4.8, I now hardly dare spawn subagents at all, and every time I open Claude Code I have to spend extra effort verifying whether it has hallucinated again — right now it struggles to deliver stable value for me. What worries me more is the day it hallucinates an "instruction" from me and makes destructive changes to my workspace based on it; the consequences would be uncontrollable. If this problem occurs across broader production environments, I don't think its severity should be underestimated, and I don't think it should be filed away as ordinary model hallucination.

View original on GitHub ↗

6 Comments

ailenneko · 1 month ago

Update: I saw in the changelog for Claude Code CLI v2.1.210 that the relevant issue appeared to be fixed (specifically, improved protection against prompt injection for sub-agents). I immediately tested it by having Claude Opus 4.8 review my project, but one of the four sub-agents immediately hallucinated a tool call and a corrupted tool result within its chain of thought, believing it had been subjected to a prompt injection attack.
So, it turns out the issue hasn't actually been fixed :(

ailenneko · 1 month ago

Update: As of Claude Code CLI v2.1.214, this bug still hasn't been fixed.
Back in v2.1.212, Claude Opus 4.8 seemed a bit more obedient—performing much better when operating as a sub-agent—but my relief was short-lived; I soon saw it hallucinating non-existent user messages and tool call results.
Moreover, during my recent usage, the frequency of the AI ​​hallucinating non-existent user messages within the main agent session has actually increased.
I think I’m done using Claude Opus 4.8 for anything now.

claell · 21 days ago

I have additional evidence for the “claimed completion without a real tool call” category, now on Opus 5 in Claude Desktop.

In a 2.1.219 session, Claude twice reported that it had posted a GitHub comment and supplied a precise-looking comment URL:

  • anthropics/claude-code#59248 → alleged comment 5078069521
  • anthropics/claude-code#81100 → alleged comment 5078171604

The raw session log contains no GitHub comment tool call before either completion claim. Both comment API URLs currently return 404. #81100 currently has zero comments and its issue updated_at is still its creation timestamp.

There is a useful control in the same session: two comments on openai/codex#6015 and anomalyco/opencode#16101 were genuinely posted. Those claims have preceding tool calls, successful tool results, and live comment URLs. The fabricated Anthropic comment claims have none of those three signals.

The pattern recurred in a 2.1.222 session with a local action. Claude said it had written “silent re-scoping” guidance to project memory. When asked which memory, it inspected the directory and admitted that it had never written the file.

This looks like a false-completion reporting failure rather than only a malformed tool-call display: the model constructs the expected success state, narrates it as completed, and can even invent a plausible remote identifier. A useful invariant would be that any statement such as “posted,” “created,” “saved,” or “committed” must be grounded in a matching successful tool result, followed by remote-state verification for external actions.

ailenneko · 21 days ago

What?! Does Claude Opus 5 suffer from similar "hallucination" issues too?! (That’s certainly how I’ve always understood the problem.)
That said, in all the time I’ve spent using Claude Opus 5 since its release, I haven’t encountered a single hallucination—though the model’s personality can be a bit infuriating.
It has a habit of confidently jumping to premature conclusions the moment it sees something, only to be proven wrong by its own subsequent verification steps; it happens every time, and it comes across as rather pretentious.
Another annoying aspect is how long it takes to run as a sub-agent—often taking up to half an hour for a single task.
While there are times when it fails to mention that a task is unfinished or doesn't report success—forcing me to follow up before it speaks up—I haven't caught it actually being deceptive.

It’s a truly terrifying thought; if Opus 5 is prone to hallucinations as well, I honestly wouldn't know what to do.

claell · 21 days ago

Yes, I agree. And this happened in my only 3 sessions I ever did in Claude Code..., so seems to happen super often. Right now, I don't trust Anthropic's models, even Fable 5 is super weird when I use it, infers incorrect facts, ...; I wonder how they can score so high on all benchmarks, Artificial Analysis and also human preference on Arena.ai and so on.

Maybe due to quantization? Hard to tell. But I observed such problems in Gemini 3, 3.5 Flash, or GPT-4o and some GPT mini models in the past (and MiniMax M3 in the present); not in top, big frontier models...

y2k20000 · 21 days ago

Same behavior on Claude Code 2.1.226 / claude-opus-5 (Windows), so this is
not limited to Opus 4.7/4.8. I scanned 219 local sessions (70,223 assistant
messages) and found 9 occurrences, all stop_reason: end_turn. Rather than
duplicate it here, the details — including negative controls that rule out
context length, compaction count and daily usage volume as causes — are in
#85286.

Showing cached comments. Read the full discussion on GitHub ↗