[MODEL] Agent draws false conclusions from empty tool results instead of questioning the search

Resolved 💬 4 comments Opened Mar 8, 2026 by carrotRakko Closed Apr 5, 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

Claude made incorrect assumptions about my project

What You Asked Claude to Do

I asked Claude to update a file (changelog.md) as part of a documented procedure. The procedure itself (which Claude had just read from the same parent directory) references changelog.md, so its existence was expected.

What Claude Actually Did

  1. Claude searched for the file using Glob with a malformed pattern (contained a stray " character at the end: **/changelog*")
  2. Got 0 results — expected, since no filename ends with a literal "
  3. Searched a second time with the same malformed pattern in a different directory
  4. Got 0 results again
  5. Concluded: "changelog.md does not exist. Need to create it."
  6. Proceeded to plan creating the file from scratch

At no point did Claude:

  • Notice the pattern was malformed
  • Question why a file referenced by the procedure didn't exist
  • Retry with a corrected pattern

Expected Behavior

When a tool search returns 0 results, especially when the target is expected to exist (referenced by a document already in context), the agent should:

  1. Verify the search pattern/query is well-formed before trusting the result
  2. Consider that 0 results may indicate a bad query rather than absent target
  3. Retry with alternative patterns if the result contradicts expectations

The general issue: the agent treats tool results as ground truth without validating that the tool was invoked correctly. A typo in a search pattern is indistinguishable from "target doesn't exist" at the result level (both return 0), but the agent always assumes the latter.

Files Affected

N/A (no files were incorrectly modified — caught before action)

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Haven't tried to reproduce

Steps to Reproduce

Not a specific reproduction, but the general pattern:

  1. Have a file that the agent is expected to find (e.g., referenced in a document it already read)
  2. The agent searches for it using Glob/Grep with a subtly malformed pattern (e.g., trailing quote character, wrong escape)
  3. Tool returns 0 results
  4. Agent concludes the file doesn't exist instead of questioning the query

Claude Model

Opus

Relevant Conversation

● Bash(cat /path/to/changelog.md)
  ⎿  cat: /path/to/changelog.md: No such file or directory

● Search(pattern: "**/changelog*"", path: "/workspaces/project-a")
  ⎿  Found 0 files

● Search(pattern: "**/changelog*"", path: "/workspaces/project-b")
  ⎿  Found 0 files

Agent then said: "changelog.md does not exist. Need to create it."

The file existed at /workspaces/project-b/docs/changelog.md the entire time. A correct pattern **/changelog* (without trailing ") would have found it.

Impact

Medium - Extra work to undo changes

Claude Code Version

2.1.71 (Claude Code)

Platform

Anthropic API

Additional Context

This is a broader pattern beyond just Glob typos. Whenever any search tool (Glob, Grep, gh issue list, etc.) returns empty results, the agent tends to accept the empty result at face value rather than considering whether the query itself was flawed.

This is particularly problematic when:

  • The target's existence is implied by context already in the conversation (e.g., a procedure document referencing the file)
  • The same malformed query is retried in different locations, reinforcing the false conclusion
  • The agent has high confidence in its conclusion despite weak evidence (a single empty search result)

A possible mitigation approach: when a search returns 0 results and the agent is about to draw a "does not exist" conclusion, it could be prompted (via system prompt, tool post-processing, or model behavior) to briefly verify the query syntax and consider contextual expectations before concluding.

✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗