hermes - ✅(Solved) Fix memory tool replace/remove fails with "old_text is required" even when old_text is provided [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

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
NousResearch/hermes-agent#23381Fetched 2026-05-11 03:29:44
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Timeline (top)
labeled ×4closed ×1commented ×1cross-referenced ×1

Error Message

The memory tool with action=replace and action=remove consistently fails with error: {"error": "old_text is required for ... action.", "success": false}

Fix Action

Fixed

PR fix notes

PR #23399: fix(memory): add if/then schema constraint requiring old_text for rep…

Description (problem / solution / changelog)

What does this PR do?

The memory tool schema declared only action and target as required parameters. LLMs that strictly follow the JSON Schema would treat old_text as optional and omit it from tool calls for replace and remove actions — causing the handler to immediately return "old_text is required" even when the user explicitly instructed the agent to provide a substring.

Fix:

  • Adds a JSON Schema if/then conditional that marks old_text as required when action is "replace" or "remove"
  • Updates the old_text field description to explicitly state it is REQUIRED for those actions

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

References

Fixes #23381

Checklist

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits
  • My PR contains only changes related to this fix

Changed files

  • tools/memory_tool.py (modified, +79/-35)

Code Example

{"error": "old_text is required for ... action.", "success": false}
RAW_BUFFERClick to expand / collapse

Bug Description

The memory tool with action=replace and action=remove consistently fails with error:

{"error": "old_text is required for ... action.", "success": false}

even when old_text is correctly passed as a parameter and the substring exists in the existing memory entry.

Reproduction Steps

  1. Have existing memory entries (total ~2167/2200 chars, 12 entries)
  2. Call memory(action=replace, target=memory, old_text=<unique_substring>, content=<new_content>)
  3. Always fails with "old_text is required" regardless of the substring used

Tried 14+ times with different approaches:

  • Full entry text as old_text
  • Unique substrings of varying lengths
  • Different entries (cron jobs, paperless-ngx, etc.)
  • action=remove also fails the same way
  • action=add works but memory is full (2200 char limit)

Expected Behavior

replace should find the entry containing old_text and update it. remove should delete it.

Environment

  • Hermes Agent v2.1.4
  • Model: qwen3.6-plus (Alibaba)
  • Memory: 12 entries, ~2167/2200 chars used
  • Tool: memory.py - memory tool implementation

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

hermes - ✅(Solved) Fix memory tool replace/remove fails with "old_text is required" even when old_text is provided [1 pull requests, 1 comments, 2 participants]