-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Description
Summary
OpenClaw fails to execute tools when the model outputs tool names with leading/trailing whitespace. The error message shows "Tool not found" (notice double space), indicating the tool name is empty or contains whitespace that isn't being trimmed before lookup.
Steps to reproduce
- Start any OpenClaw session
- Ask the agent to perform tool calls (read, exec, gateway, etc.)
- Observe intermittent failures with error: {"status": "error", "tool": "<tool_name>", "error": "Tool not found"}
Note the double space in "Tool not found" - the tool name is empty or whitespace-padded.
Expected behavior
Tool names should be normalized (trimmed of leading/trailing whitespace) before lookup. The following should all work:
• Tool call with "read" → executes read tool
• Tool call with " read" → executes read tool (whitespace trimmed)
• Tool call with "read " → executes read tool (whitespace trimmed)
• Tool call with " read " → executes read tool (whitespace trimmed)
The system should gracefully handle whitespace in tool names and match them correctly to available tools.
Actual behavior
Tool calls fail intermittently when the model outputs tool names with whitespace:
Input: {"file_path": "/data/.openclaw/workspace/test.txt"}
Error: {"status": "error", "tool": "read", "error": "Tool not found"}
The double space in "Tool not found" indicates call.name is empty or contains only whitespace. The lookup fails because " read" ≠ "read" in the toolsByName map.
OpenClaw version
2026.2.23
Operating system
Linux 6.8.0-94-generic (x64)
Install method
docker
Logs, screenshots, and evidence
Impact and severity
No response
Additional information
No response