oldString and newString must be different #3101

Open
opened 2026-02-16 17:38:38 -05:00 by yindo · 17 comments
Owner

Originally created by @Aletheia-Prime on GitHub (Nov 24, 2025).

Description

"oldString and newString must be different"

OpenCode version

v1.0.109

Steps to reproduce

Current problematic line ##:
await runCommand('npm', ['run', 'runtime:cli', 'queue', '--', VARIABLE], 'Queue item');
Should be:
await runCommand('npm', ['run', 'runtime:cli', 'queue', '--', VARIABLE], 'Queue item');

The line is already the way the software wants it to be, but Big Pickle is stuck in a loop.

Screenshot and/or share link

No response

Operating System

WSL 2.6.1.0

Terminal

WSL 2.6.1.0 in PowerShell 7.5.4

Originally created by @Aletheia-Prime on GitHub (Nov 24, 2025). ### Description "oldString and newString must be different" ### OpenCode version v1.0.109 ### Steps to reproduce ``` Current problematic line ##: await runCommand('npm', ['run', 'runtime:cli', 'queue', '--', VARIABLE], 'Queue item'); Should be: await runCommand('npm', ['run', 'runtime:cli', 'queue', '--', VARIABLE], 'Queue item'); ``` The line is already the way the software wants it to be, but Big Pickle is stuck in a loop. ### Screenshot and/or share link _No response_ ### Operating System WSL 2.6.1.0 ### Terminal WSL 2.6.1.0 in PowerShell 7.5.4
Author
Owner

@github-actions[bot] commented on GitHub (Nov 24, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #4466: "big pickle: blank edit loop" - Reports getting stuck editing with blank output until stopped with Big Pickle model
  • #266: "gemini doesn't handle edit tool very well" - Reports edit tool failures with "oldString not found in file" error suggesting whitespace normalization issues
  • #4322: "have error with tool call from 1.0.62 build" - Similar issue where GLM 4.6 fails with edit tool, suggesting oldString/newString problems with tool calls
  • #2052: "Subagents often getting stuck into tool usage loops" - Reports subagents getting stuck on tool usage loops
  • #3743: "Loop in certain models" - Reports models getting stuck in loops with certain providers (KIMI K2, MiniMax, GLM 4.6)
  • #2529: "Edit tool input string replacement idea" - Discusses model confusion when edits are formatted, causing subsequent edit failures

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 24, 2025): This issue might be a duplicate of existing issues. Please check: - #4466: "big pickle: blank edit loop" - Reports getting stuck editing with blank output until stopped with Big Pickle model - #266: "gemini doesn't handle edit tool very well" - Reports edit tool failures with "oldString not found in file" error suggesting whitespace normalization issues - #4322: "have error with tool call from 1.0.62 build" - Similar issue where GLM 4.6 fails with edit tool, suggesting oldString/newString problems with tool calls - #2052: "Subagents often getting stuck into tool usage loops" - Reports subagents getting stuck on tool usage loops - #3743: "Loop in certain models" - Reports models getting stuck in loops with certain providers (KIMI K2, MiniMax, GLM 4.6) - #2529: "Edit tool input string replacement idea" - Discusses model confusion when edits are formatted, causing subsequent edit failures Feel free to ignore if none of these address your specific case.
Author
Owner

@spoons-and-mirrors commented on GitHub (Nov 24, 2025):

This is not a bug, this is Big Pickle doing its thing

@spoons-and-mirrors commented on GitHub (Nov 24, 2025): This is not a bug, this is Big Pickle doing its thing
Author
Owner

@rekram1-node commented on GitHub (Nov 24, 2025):

Yeah if it got caught in a loop we have some other tickets tracking that, sometimes this happens to glm and grok code models.

@rekram1-node commented on GitHub (Nov 24, 2025): Yeah if it got caught in a loop we have some other tickets tracking that, sometimes this happens to glm and grok code models.
Author
Owner

@tinmarr commented on GitHub (Nov 29, 2025):

Running /compact seems to temporarily fix the infinite looping. Could be something related to large contexts?

@tinmarr commented on GitHub (Nov 29, 2025): Running `/compact` seems to temporarily fix the infinite looping. Could be something related to large contexts?
Author
Owner

@rekram1-node commented on GitHub (Nov 30, 2025):

Yeah long contexts and just the more it sees a pattern the more likely it will repeat it, so you need to break the loop

@rekram1-node commented on GitHub (Nov 30, 2025): Yeah long contexts and just the more it sees a pattern the more likely it will repeat it, so you need to break the loop
Author
Owner

@kianwoon commented on GitHub (Dec 14, 2025):

The issue is quite irritating and completely renders the opencode unusable. Perhaps it's time to move on to another AI coding tool. If an AI coding tool even fails to save itself, then it already justifies "Don't waste time" and just switch.

@kianwoon commented on GitHub (Dec 14, 2025): The issue is quite irritating and completely renders the opencode unusable. Perhaps it's time to move on to another AI coding tool. If an AI coding tool even fails to save itself, then it already justifies "Don't waste time" and just switch.
Author
Owner

@dave-schmidt-dev commented on GitHub (Jan 18, 2026):

I’m seeing this error quite frequently today using Gpt 5.2 Codex

@dave-schmidt-dev commented on GitHub (Jan 18, 2026): I’m seeing this error quite frequently today using Gpt 5.2 Codex
Author
Owner

@jptrs93 commented on GitHub (Jan 18, 2026):

I also see it pretty often with Gpt 5.2 Codex

@jptrs93 commented on GitHub (Jan 18, 2026): I also see it pretty often with Gpt 5.2 Codex
Author
Owner

@mneed commented on GitHub (Jan 19, 2026):

I also see it pretty often with Gpt 5.2 Codex, please check it,my version v1.1.25
vscode env

@mneed commented on GitHub (Jan 19, 2026): I also see it pretty often with Gpt 5.2 Codex, please check it,my version v1.1.25 vscode env
Author
Owner

@spoons-and-mirrors commented on GitHub (Jan 19, 2026):

Just PRd a small fix for this (for the oldString not found in content error path), hopefully this will better guide the model when facing this error.

@spoons-and-mirrors commented on GitHub (Jan 19, 2026): Just PRd a small fix for this (for the oldString not found in content error path), hopefully this will better guide the model when facing this error.
Author
Owner

@JorgeMenaDev commented on GitHub (Jan 20, 2026):

fix it please!!!

@JorgeMenaDev commented on GitHub (Jan 20, 2026): fix it please!!!
Author
Owner

@ForLoopCodes commented on GitHub (Jan 22, 2026):

Image
@ForLoopCodes commented on GitHub (Jan 22, 2026): <img width="317" height="190" alt="Image" src="https://github.com/user-attachments/assets/f4ee3083-adca-4a40-8060-b2d639b37d3f" />
Author
Owner

@pcgeek86 commented on GitHub (Jan 28, 2026):

I'm having the same error in OpenCode. This is one of several reasons I don't use OpenCode very much. Decided to give it another try tonight, but it's wasted effort once again.

  • Windows 11
  • OpenCode 1.1.29
  • LM Studio 0.4.0 Build 18
  • Model: mistralai/ministral-3-14b-reasoning
  • Context Size: 18,000 tokens (less than 14k used before error occurred)
  • NVIDIA GeForce RTX 5080
  • NVIDIA driver 591.86

My user prompt was simply to generate a very simple software project in Rust. 🦀

I wish I could rely on OpenCode more, because it's the only tool like it. It's just too unreliable, unfortunately. I appreciate the work on the open source software, regardless. Hoping to see the days when it gets better.

@pcgeek86 commented on GitHub (Jan 28, 2026): I'm having the same error in OpenCode. This is one of several reasons I don't use OpenCode very much. Decided to give it another try tonight, but it's wasted effort once again. - Windows 11 - OpenCode 1.1.29 - LM Studio 0.4.0 Build 18 - **Model**: `mistralai/ministral-3-14b-reasoning` - **Context Size**: 18,000 tokens (_less than 14k used before error occurred_) - NVIDIA GeForce RTX 5080 - NVIDIA driver 591.86 My user prompt was simply to generate a very simple software project in Rust. 🦀 I wish I could rely on OpenCode more, because it's the only tool like it. It's just too unreliable, unfortunately. I appreciate the work on the open source software, regardless. Hoping to see the days when it gets better.
Author
Owner

@joshuachendyb commented on GitHub (Jan 31, 2026):

always show this message recently
1146 1147 versuon

@joshuachendyb commented on GitHub (Jan 31, 2026): always show this message recently 1146 1147 versuon
Author
Owner

@tinmarr commented on GitHub (Feb 1, 2026):

Seems very model dependent. Using kimi-k2-free pretty heavily over the weekend (opencode 1.1.45-1.1.48) and I haven't see this issue once.

@tinmarr commented on GitHub (Feb 1, 2026): Seems very model dependent. Using kimi-k2-free pretty heavily over the weekend (opencode 1.1.45-1.1.48) and I haven't see this issue once.
Author
Owner

@kleyton67 commented on GitHub (Feb 10, 2026):

Is my error related to this behavior/issue?

Tool: edit

Input:

{
  "oldString": "  const startPosRef = useRef<{ x: number; y: number; }>({ x: 0, y: 0 });\n  const startDimensionsRef = useRef<{ width: number; height: number; }>({ width, height });\n\n  useEffect(() => {\n    console.log(\"test\");\n\n  }, []);\n\n  return (",
  "newString": "  const [size, setSize] = useState<'default' | 'medium' | 'large'>('default');\n  const startPosRef = useRef<{ x: number; y: number; }>({ x: 0, y: 0 });\n  const startDimensionsRef = useRef<{ width: number; height: number; }>({ width, height });\n\n  useEffect(() => {\n    console.log(\"test\");\n\n  }, []);\n\n  return (",
  "replaceAll": true,
  "filePath": "/root/workspace/projetos/model-weaver/src/components/TableNode.tsx"
}

Error:

Error: oldString not found in content

My env:

  • node 24
  • OpenCoder from OpenAgents
  • Ollama : Model qwen3:8b
@kleyton67 commented on GitHub (Feb 10, 2026): Is my error related to this behavior/issue? **Tool: edit** **Input:** ```json { "oldString": " const startPosRef = useRef<{ x: number; y: number; }>({ x: 0, y: 0 });\n const startDimensionsRef = useRef<{ width: number; height: number; }>({ width, height });\n\n useEffect(() => {\n console.log(\"test\");\n\n }, []);\n\n return (", "newString": " const [size, setSize] = useState<'default' | 'medium' | 'large'>('default');\n const startPosRef = useRef<{ x: number; y: number; }>({ x: 0, y: 0 });\n const startDimensionsRef = useRef<{ width: number; height: number; }>({ width, height });\n\n useEffect(() => {\n console.log(\"test\");\n\n }, []);\n\n return (", "replaceAll": true, "filePath": "/root/workspace/projetos/model-weaver/src/components/TableNode.tsx" } ``` **Error:** ``` Error: oldString not found in content ``` My env: - node 24 - OpenCoder from OpenAgents - Ollama : Model qwen3:8b
Author
Owner

@fortuneyan commented on GitHub (Feb 12, 2026):

After updated to 1.1.60, report "oldString and newString must be different" repeatly while reading a js file.

@fortuneyan commented on GitHub (Feb 12, 2026): After updated to 1.1.60, report "oldString and newString must be different" repeatly while reading a js file.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3101