claude-code - 💡(How to fix) Fix [MODEL] Spurious Edit tool calls with constant arguments emitted twice in same session (Opus 4.7) [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#54220Fetched 2026-04-29 06:33:04
View on GitHub
Comments
2
Participants
2
Timeline
8
Reactions
0
Timeline (top)
labeled ×6commented ×2

Code Example

None — both calls targeted a non-existent path and failed immediately with no side effect.

Target path (does not exist): /home/ishigetani/cli-temp/dist/cli-native.js

Note: The username prefix /home/ishigetani/ matches the session's working directory (/home/ishigetani/Docker/local-japanex-docker), so this part is plausibly derived from environment context (cwd / shell prompt). However, the cli-temp/dist/cli-native.js suffix has no source in user input, project files, CLAUDE.md, or session transcript.

---

[The exact tool call JSON is shown in "What Claude Actually Did" above. There was no preceding text response or reasoning shown to the user — the unsolicited Edit call appeared in the middle of legitimate work.]
RAW_BUFFERClick to expand / collapse

Preflight Checklist

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

Type of Behavior Issue

Other unexpected behavior

What You Asked Claude to Do

Nothing related to this path. The unsolicited tool calls happened mid-task while Claude was performing legitimate edits on a different codebase. The path /home/ishigetani/cli-temp/dist/cli-native.js was never mentioned by me, never existed in the project, and never appeared in any CLAUDE.md or session context.

What Claude Actually Did

Within a single long-lived session, Claude emitted two unsolicited Edit tool calls with completely identical (constant) arguments targeting a path that does not exist on the filesystem and was never referenced anywhere in the session.

Tool call (verbatim, both occurrences): { "name": "Edit", "input": { "replace_all": false, "file_path": "/home/ishigetani/cli-temp/dist/cli-native.js", "old_string": "test", "new_string": "test2" } }

  • First occurrence: 2026-04-28T01:23:04.956Z (request_id: req_011CaVJ2Xh6a6PHPQ6gfLVaT)
  • Second occurrence: 2026-04-28T06:35:48.177Z (request_id: req_011CaVhsihvkCmgsRugVX5Ye)
  • Interval: ~5h 12m 43s, same session
  • Both occurrences happened immediately after a TodoWrite update
  • Both calls failed immediately ("File does not exist") with no side effect

The constancy of the arguments (test → test2) suggests a degenerate generation pattern rather than reasoning.

Expected Behavior

Tool invocations should be grounded in:

  • user input
  • project context (existing files, referenced paths)
  • or the assistant's explicit prior reasoning

The assistant should not emit tool calls with constant placeholder-like arguments to paths it has no basis to reference.

Files Affected

None — both calls targeted a non-existent path and failed immediately with no side effect.

Target path (does not exist): /home/ishigetani/cli-temp/dist/cli-native.js

Note: The username prefix /home/ishigetani/ matches the session's working directory (/home/ishigetani/Docker/local-japanex-docker), so this part is plausibly derived from environment context (cwd / shell prompt). However, the cli-temp/dist/cli-native.js suffix has no source in user input, project files, CLAUDE.md, or session transcript.

Permission Mode

Accept Edits was ON (auto-accepting changes)

Can You Reproduce This?

Sometimes (intermittent)

Steps to Reproduce

Not deterministically reproducible. Both occurrences happened during normal editing workflow within a single long-lived session, immediately after a TodoWrite update. No specific user input or project context preceded either call.

Claude Model

Opus

Relevant Conversation

[The exact tool call JSON is shown in "What Claude Actually Did" above. There was no preceding text response or reasoning shown to the user — the unsolicited Edit call appeared in the middle of legitimate work.]

Impact

Low - Minor inconvenience

Claude Code Version

2.1.120

Platform

Anthropic API

Additional Context

  • Tool use IDs and session ID available on request if helpful for tracing.
  • The pattern (constant args "test" → "test2", non-existent path, occurring twice with identical content) suggests this is not a one-off sampling artifact but a degenerate generation mode worth investigating at the model/serving layer.

extent analysis

TL;DR

Investigate the Opus model's generation patterns and session context handling to identify why Claude is emitting unsolicited Edit tool calls with constant arguments to non-existent paths.

Guidance

  • Review the Opus model's code and training data to determine if there's a degenerate generation pattern causing the constant arguments ("test" → "test2") in the Edit tool calls.
  • Analyze the session context and working directory to understand how the username prefix /home/ishigetani/ is being derived and if it's influencing the generation of the non-existent path.
  • Investigate the relationship between TodoWrite updates and the emission of unsolicited Edit tool calls, as both occurrences happened immediately after a TodoWrite update.
  • Consider adding logging or tracing to capture more information about the model's decision-making process and the input data that leads to these unsolicited calls.

Example

No code snippet is provided as the issue is related to the model's behavior and not a specific code implementation.

Notes

The intermittent nature of the issue and the lack of deterministically reproducible steps make it challenging to investigate. The fact that the issue is specific to the Opus model and the Anthropic API suggests that the problem might be related to the model's implementation or the API's handling of session context.

Recommendation

Apply workaround: Implement additional logging and tracing to capture more information about the model's decision-making process and the input data that leads to these unsolicited calls, to help identify the root cause of the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING