#My agent is asking ME how to use the `edit` tool !

1 messages · Page 1 of 1 (latest)

lofty jungle
#

I asked my agent to update their memory from lessons learned, and the log gave these errors:

2026-04-10T18:35:30.963+08:00 [tools] edit failed: Missing required parameters: oldText alias, newText alias. Supply correct parameters before retrying.

My agent then said this:

I encountered an error while trying to update MEMORY.md. The tool output indicates missing parameters for oldText or newText aliases, which is unusual as I provided them. It's possible there was a misunderstanding in how the edit tool expects these parameters, especially when modifying existing text versus appending.

Let me re-evaluate how to best perform these updates. I will try to apply the edits one by one or adjust the parameters if needed. Given the error, it might be safer to try appending the new section first, as modifying existing text can be more sensitive to precise matching.

Could you please advise on the correct parameter format for edit if it differs from what I've used? Or shall I attempt to append the new exec notes separately?

... huh? How the hell am I supposed to know? @chrome pendant why doesn't my agent know how a built-in tool should be used?

chrome pendantBOT
#

I checked the code path. This looks like a real bug or schema/translation mismatch, not something you should've been asked to solve yourself. Let me pin down where it's happening.

#

Yeah, that’s not on you.

I checked current OpenClaw source. The built-in edit tool expects this shape:

{
  "path": "MEMORY.md",
  "edits": [
    { "oldText": "...", "newText": "..." }
  ]
}

So, a few important bits:

  • oldText / newText belong inside edits[]
  • they are not top-level params
#
  • legacy alias-y payloads are supposed to be rejected
  • the agent should not be asking you how a built-in tool works

Also, that exact error text, Missing required parameters: oldText alias, newText alias, does not match current main. On current code I’d expect something more like missing edits.

So the likely causes are:

  1. the model mangled the nested tool args, especially the edits array, or
  2. you’re on a version with a bad schema/adapter path

In short, the agent doesn’t “know” tool usage the way normal code knows it, it gets a schema at runtime and sometimes the model still screws it up. Runtime validation catches it, but in this case the fallback behavior was bad.

Can you paste:

openclaw --version
lofty jungle
#

2026.03.28. if you tell me how where to look for the args the agent constructed, I can get it for you

chrome pendantBOT
#

I’ll check where OpenClaw logs tool-call args on your version path, so I can point you to the right spot instead of guessing.

#

Ah, that version explains a lot.

You’re on 2026.03.28, and the bug is very likely already fixed a couple days later.

I checked the source history, and right after your version there were these fixes:

  • 2026-03-30: coerce streaming tool-call args back into objects
  • 2026-03-31: support edit tool edits[] payloads
  • 2026-03-31: log malformed tool params as raw_params=...

That exact error text, oldText alias, newText alias, comes from the older validator path. In that older code, edit validation was still acting like it wanted flat oldText / newText style params, instead of the modern:

{
  "path": "MEMORY.md",
  "edits": [
#
    { "oldText": "...", "newText": "..." }
  ]
}

So, bluntly: this looks like a version bug, not you failing to teach your agent how its own built-in tool works.

Where to look for args

Best place:

openclaw logs --follow

Then reproduce it and search for:

#
  • edit failed
  • toolCallId=
  • raw_params=

If openclaw logs --follow doesn’t work, fallback:

tail -f "$(ls -t /tmp/openclaw/openclaw-*.log | head -1)"

Important caveat

On 2026.03.28, the nice malformed-param logging with raw_params=... was not there yet. So you may not be able to recover the exact args cleanly from that build.

My recommendation

I’d update first using the normal update path here:

https://docs.openclaw.ai/install/updating

#

Then retry once. If it still fails on a newer build, grab the log line with raw_params= and paste it here, and I can tell you exactly what the model emitted.

lofty jungle
#

Update... OpenClaw? Ok I will think about it. I run docker so I have a different update procedure, but ok I will consider it if it seems to be a version bug.

chrome pendantBOT
#

Let me verify the pre-fix behavior so I can tell you whether there’s a safe temporary workaround on your current Docker build.

#

Yeah, I’m comfortable calling it a version bug.

I checked the pre-fix code for your timeframe, and on 2026.03.28 the edit path still expected the legacy flat signature:

{
  "path": "MEMORY.md",
  "oldText": "...",
  "newText": "..."
}

Not the newer form:

{
#
  "path": "MEMORY.md",
  "edits": [
    { "oldText": "...", "newText": "..." }
  ]
}

So if your agent used edits: [...], that older runtime would complain about missing oldText / newText aliases. That’s why the agent got itself twisted up.

Short version

You’ve got 2 options:

  1. Update OpenClaw / your Docker image
    Best fix.