HKUDS/nanobot · error · ValueError
Unknown old_text
Error message
Unknown old_text
What it means
Error "Unknown old_text" thrown in HKUDS/nanobot.
Source
Thrown at nanobot/agent/tools/filesystem.py:928
"Shows closest-match diagnostics on failure."
)
@staticmethod
def _strip_trailing_ws(text: str) -> str:
"""Strip trailing whitespace from each line."""
return "\n".join(line.rstrip() for line in text.split("\n"))
async def execute(
self, path: str | None = None, old_text: str | None = None,
new_text: str | None = None,
replace_all: bool = False, occurrence: int | None = None,
line_hint: int | None = None, expected_replacements: int | None = None, **kwargs: Any,
) -> str:
try:
if not path:
raise ValueError("Unknown path")
if old_text is None:
raise ValueError("Unknown old_text")
if new_text is None:
raise ValueError("Unknown new_text")
if occurrence is not None and occurrence < 1:
return ToolResult.error("Error: occurrence must be >= 1.")
if line_hint is not None and line_hint < 1:
return ToolResult.error("Error: line_hint must be >= 1.")
if expected_replacements is not None and expected_replacements < 1:
return ToolResult.error("Error: expected_replacements must be >= 1.")
fp = self._resolve_write(path)
file_exists = fp.exists()
if file_exists and old_text == new_text:
return ToolResult.error("Error: new_text must be different from old_text.")
# Create-file semantics: old_text='' + file doesn't exist → create
if not file_exists:
if old_text == "":
fp.parent.mkdir(parents=True, exist_ok=True)View on GitHub (pinned to 42f37dc4c0)
When it happens
Trigger: Thrown at nanobot/agent/tools/filesystem.py:928 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26).
Data as JSON: /api/errors/1ec102fd0f0601d8.
Report an issue: GitHub.