Apply_patch returning "Illegal value for lineNumber"

Hey guys,

I’m running into issue with agent today – it says it can’t make edits to files directly because “The code-edit tool (apply_patch) in this workspace is consistently returning an internal error: Illegal value for lineNumber.”

Tried forcing an update with Cmd+Shift+P and restarting it, but didn’t work.

What should I do?

this may be related to the cloud agent degradation at the moment. regardless, try these workarounds:

  • ask the agent to output a unified diff and apply it locally (git apply / patch)
  • or: have it print full file contents and paste manually

switching off cloud agent to local should also avoid the failing apply_patch path

Thank Jake.

The solution was to turn on other models and try a new task in another chat. I was running only Opus 4.5 and it failed even after Cloud Agents degradation was resolved, but adding most other models and starting new chat did the trick.

1 Like