openclaw - 💡(How to fix) Fix Parameter injection "{}" causes an infinite loop in tool invocation [1 comments, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

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
openclaw/openclaw#69582Fetched 2026-04-22 07:50:33
View on GitHub
Comments
1
Participants
1
Timeline
3
Reactions
0
Author
Participants
Timeline (top)
labeled ×2commented ×1

When calling the local model glm-5 tool, the parameters are inevitably 'contaminated' by {}

Error Message

process(action={}) ← Error: action should be a string like "poll" or "list", not an empty object

Root Cause

Root cause: When constructing the tool parameters, I mistakenly used {} as the parameter value instead of the correct string value.

Code Example

process(action={})Error: action should be a string like "poll" or "list", not an empty object

---

{"action": {}}Error: sessionId is required for this action

---
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When calling the local model glm-5 tool, the parameters are inevitably 'contaminated' by {}

Affected Tools

ToolParameterExpected TypeCorrupted Value
editnewTextstring"value{}"
editpathstring"path.md{}"
processactionstring{} (object)

Proposed Solution

  • Option A: Framework layer parameter cleaning (recommended)
  • Option B: Schema Validation + Automatic Correction
  • Option C: System Tip Enhancement

Environment

  • OpenClaw version: 2026.3.24
  • Model: local/glm-5
  • OS: Windows 11

Steps to reproduce

Tool call infinite loop

Expected behavior

Tool call infinite loop

Actual behavior

伪代码:工具参数校验

def sanitize_tool_params(tool_name, params): for key, value in params.items(): if isinstance(value, str): # 移除末尾的 {} if value.endswith("{}"): params[key] = value[:-2] elif isinstance(value, dict) and len(value) == 0: # 空对象可能是错误,根据schema检查 if key == "action": # action应该是字符串 raise ValueError(f"参数 {key} 不能是空对象") return params

OpenClaw version

OpenClaw version: 2026.3.24

Operating system

window11

Install method

npm global

Model

local/glm-5

Provider / routing chain

opencalw -> tool calll ->local glm-5

Additional provider/model setup details

openclaw self-check feedback content User pointed out that I got stuck when calling the process tool, repeatedly outputting the same thing. Let me analyze the problem:

  1. When I called the process tool, {} appeared multiple times as a parameter, which is incorrect.
  2. It seems my tool call construction is problematic, repeatedly passing empty {} parameters.

Let me check exactly where the problem occurred. According to previous error records:

  • {"action": {}} - the action parameter is an empty object, not a string
  • This caused the tool to repeatedly report the error sessionId is required for this action

This is an issue with constructing tool call parameters; I passed {} as the value of action, instead of a valid string like "poll" or "list".

Root cause: When constructing the tool parameters, I mistakenly used {} as the parameter value instead of the correct string value.

This is similar to the previous {} issue with the edit tool, a mistake I made when constructing tool parameters. Problem Analysis:

When calling the process tool, the parameters were constructed incorrectly, repeatedly passing {} as the action parameter:

process(action={}) ← Error: action should be a string like "poll" or "list", not an empty object

Error Log:

{"action": {}} → Error: sessionId is required for this action

Root Cause:

IssueReason
process(action={})action parameter should be a string, but I passed an empty object
Repeated callsModel fell into a loop, continuously retrying the incorrect parameter

This is the same problem: Like the previous {} issue with the edit tool, {} was mistakenly inserted when constructing tool parameters, causing a parameter type error.

Recorded: This kind of problem will be noted in MEMORY.md as a lesson learned to avoid it in the future.

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

TL;DR

The issue can be fixed by properly sanitizing tool parameters to remove or handle empty objects and strings ending with {}.

Guidance

  • Review the sanitize_tool_params function to ensure it correctly handles all parameter types and removes or raises errors for invalid values like empty objects and strings ending with {}.
  • Verify that the tool call construction logic is passing the correct parameter values, especially for the action parameter in the process tool, which should be a string like "poll" or "list".
  • Check the error logs for patterns indicating incorrect parameter types or values, such as the sessionId is required for this action error when an empty object is passed as the action parameter.
  • Consider implementing additional validation or correction mechanisms, such as schema validation, to prevent similar issues in the future.

Example

def sanitize_tool_params(tool_name, params):
    for key, value in params.items():
        if isinstance(value, str) and value.endswith("{}"):
            params[key] = value[:-2]  # Remove {} from the end of strings
        elif isinstance(value, dict) and len(value) == 0:
            if key == "action":  # action should be a string
                raise ValueError(f"Parameter {key} cannot be an empty object")
            else:
                # Handle or remove empty objects for other parameters as needed
                pass
    return params

Notes

The provided sanitize_tool_params function seems to be a step in the right direction but might need adjustments based on the specific requirements of each tool and parameter. Ensuring that all tools and their parameters are correctly validated and sanitized will help prevent similar issues.

Recommendation

Apply a workaround by enhancing the sanitize_tool_params function to correctly handle all parameter types and values, ensuring that empty objects and strings ending with {} are properly removed or handled. This approach allows for immediate correction of the issue without waiting for a potential framework update.

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…

FAQ

Expected behavior

Tool call infinite loop

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING