openclaw - ✅(Solved) Fix [Bug]: read and write tools fail with "Missing required parameter" after session runs for a while [1 pull requests, 1 comments, 2 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#54920Fetched 2026-04-08 01:34:29
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
1
Timeline (top)
cross-referenced ×2labeled ×2closed ×1commented ×1

read and write tools fail with "Missing required parameter" after ~15 minutes of session activity

Error Message

  1. Error occurs: "Missing required parameter: path alias" "status": "error", "error": "Missing required parameter: path alias. Supply correct parameters before retrying." 04:42:19+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_kFT5QhsaGJGy7gVbdN72MGgP argsType=object 04:42:19+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:19+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:21+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_m0OzvLUB6Ysx11j4SZiI3v4H argsType=object 04:42:21+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:21+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:23+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_Z9IAOP0KRTWnwejRKv4bFfI9 argsType=object 04:42:23+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:23+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:25+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_Z8gmQfuAdsWUGKAV4IsXAioO argsType=object 04:42:25+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:25+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:27+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_6S3cC9hWaWBTpMsjmknLsIY1 argsType=object 04:42:27+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:27+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:29+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_lRRwBRv5sW0hZ1p2wJhpuHjv argsType=object 04:42:29+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying. 04:42:29+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
  • Error first observed: 2026-03-26

Root Cause

read and write tools fail with "Missing required parameter" after ~15 minutes of session activity

Fix Action

Fix / Workaround

  • Error first observed: 2026-03-26
  • Frequency: Consistent after ~15 minutes
  • Workaround exists but disrupts workflow
  • exec tool continues to work normally when read/write fail
  • Workaround: Use exec + cat to read files, exec + echo to write files
  • Manual openclaw gateway restart restores read/write functionality
  • Issue is reproducible: happens consistently after ~15 minutes of session activity

PR fix notes

PR #54491: fix(kimi): preserve valid Anthropic-compatible toolCall arguments in malformed-args repair path

Description (problem / solution / changelog)

Summary

  • Problem: When using Kimi in Anthropic-compatible (anthropic-messages) mode, the malformed toolCall-arguments repair logic could fail to preserve otherwise-valid JSON arguments (resulting in missing/empty tool arguments).
  • Why it matters: Tool execution depends on correct toolCall.arguments; losing valid arguments can cause wrong tool behavior, failures, or unexpected “empty args” executions.
  • What changed: Adjusted the Kimi/Anthropic toolCall-argument repair path to keep valid, complete JSON arguments intact and only apply “balanced-prefix + short trailing junk” repair when the arguments are actually malformed.
  • What did NOT change (scope boundary): No changes to tool dispatch logic, tool allowlists, transcript storage, or non-Kimi providers.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

Root Cause / Regression History (if applicable)

  • Root cause: The malformed-args repair wrapper for Kimi/Anthropic streams treated some valid toolCall argument payloads as candidates for repair, and under certain stream delta patterns it could clear/override arguments instead of preserving the complete JSON object.
  • Missing detection / guardrail: Unit coverage focused on “valid JSON + short trailing junk” but didn’t adequately lock in “valid JSON must remain unchanged” across all relevant stream delta/event sequences.
  • Prior context (git blame, prior PR, issue, or refactor if known): Unknown.
  • Why this regressed now: Likely triggered by Kimi’s Anthropic-compatible streaming behavior (toolcall deltas containing } early / nested JSON / event chunking), which increased the chance the heuristic attempted repair at the wrong time.
  • If unknown, what was ruled out: Not an auth/key issue and not a tool registry/dispatch mismatch; reproduces at the stream parsing/repair layer.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/agents/pi-embedded-runner/run/attempt.test.ts (malformed toolCall args repair tests)
  • Scenario the test should lock in: When toolCall arguments are already valid JSON (including nested objects), the repair path must not alter or clear them; when valid JSON is followed by 1–3 trailing junk characters, it should repair to the valid object.
  • Why this is the smallest reliable guardrail: This bug is purely in the stream repair/parsing layer; unit tests can deterministically simulate deltas/events without requiring a live model.
  • Existing test that already covers this (if any): The suite includes a test for “trailing junk follows valid JSON”; this PR strengthens/extends coverage to ensure valid JSON remains intact.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

None (except improved reliability of tool execution for Kimi Anthropic-compatible runs).

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node.js (local)
  • Model/provider: kimi-coding/k2p5
  • Integration/channel (if any): N/A
  • Relevant config (redacted): Provider set to kimi, model API anthropic-messages

Steps

  1. Configure provider kimi with Anthropic-compatible API (anthropic-messages).
  2. Trigger a tool call where arguments are a valid nested JSON object (e.g. {"path":{"a":"/tmp/report.txt"}}) and/or where streaming deltas include early } tokens.
  3. Observe tool call arguments during/after stream assembly.

Expected

  • Valid JSON arguments are preserved exactly and passed to tool execution unchanged.

Actual

  • Arguments could be cleared/overwritten in the repair path, resulting in incomplete or empty arguments passed to tools.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: Ran the unit tests for the malformed toolCall-arguments repair and confirmed that the final assembled message preserves valid arguments; also confirmed that the “short trailing junk” repair still works. Before the fix, with Kimi in Anthropic-messages streaming mode, multiple consecutive tool_call invocations could carry empty arguments; after the fix, empty-argument tool calls no longer occur.
  • Edge cases checked: -
  • What you did not verify: -

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps: N/A

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert this commit; alternatively disable the Kimi/Anthropic malformed-args repair wrapper if maintainers prefer.
  • Files/config to restore: src/agents/pi-embedded-runner/run/attempt.ts
  • Known bad symptoms reviewers should watch for: Tool calls executed with {}/missing required parameters; intermittent tool failures only on Kimi Anthropic-compatible runs.

Risks and Mitigations

  • Risk: Repair logic might still be triggered too aggressively for some unusual streaming chunk patterns.
    • Mitigation: Keep repair gated to Kimi + anthropic-messages, retain strict trailing-suffix limits, and add/extend unit coverage for representative delta sequences.

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • src/agents/pi-embedded-runner/run/attempt.test.ts (modified, +86/-0)
  • src/agents/pi-embedded-runner/run/attempt.tool-call-argument-repair.ts (modified, +18/-6)

Code Example

{
  "status": "error",
  "tool": "read",
  "error": "Missing required parameter: path alias. Supply correct parameters before retrying."
}

---

04:42:19+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_kFT5QhsaGJGy7gVbdN72MGgP argsType=object
04:42:19+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:19+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:21+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_m0OzvLUB6Ysx11j4SZiI3v4H argsType=object
04:42:21+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:21+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:23+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_Z9IAOP0KRTWnwejRKv4bFfI9 argsType=object
04:42:23+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:23+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:25+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_Z8gmQfuAdsWUGKAV4IsXAioO argsType=object
04:42:25+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:25+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:27+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_6S3cC9hWaWBTpMsjmknLsIY1 argsType=object
04:42:27+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:27+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:29+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_lRRwBRv5sW0hZ1p2wJhpuHjv argsType=object
04:42:29+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:29+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

read and write tools fail with "Missing required parameter" after ~15 minutes of session activity

Steps to reproduce

  1. Start a new OpenClaw session
  2. Use read tool successfully (e.g., {"file":"memory/2026-03-25.md"})
  3. Continue conversation for approximately 15 minutes
  4. Try read tool again with the same parameter format
  5. Error occurs: "Missing required parameter: path alias"

Expected behavior

read and write tools should continue to work throughout the session, accepting the file parameter correctly.

Actual behavior

After ~15 minutes, both read and write tools return:

{
  "status": "error",
  "tool": "read",
  "error": "Missing required parameter: path alias. Supply correct parameters before retrying."
}

Even when explicitly providing the file parameter, the system reports it as missing.

OpenClaw version

OpenClaw 2026.3.24 (cff6dc9)

Operating system

Linux 6.8.0-106-generic (Ubuntu)

Install method

curl -fsSL https://openclaw.ai/install.sh | bash

Model

kimi/k2p5

Provider / routing chain

feishu

Additional provider/model setup details

Session started via Feishu (飞书) channel. Gateway restart temporarily fixes the issue.

Logs, screenshots, and evidence

04:42:19+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_kFT5QhsaGJGy7gVbdN72MGgP argsType=object
04:42:19+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:19+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:21+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_m0OzvLUB6Ysx11j4SZiI3v4H argsType=object
04:42:21+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:21+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:23+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_Z9IAOP0KRTWnwejRKv4bFfI9 argsType=object
04:42:23+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:23+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:25+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_Z8gmQfuAdsWUGKAV4IsXAioO argsType=object
04:42:25+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:25+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:27+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_6S3cC9hWaWBTpMsjmknLsIY1 argsType=object
04:42:27+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:27+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:29+00:00 warn agent/embedded {"subsystem":"agent/embedded"} read tool called without path: toolCallId=tool_lRRwBRv5sW0hZ1p2wJhpuHjv argsType=object
04:42:29+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.
04:42:29+00:00 error [tools] read failed: Missing required parameter: path alias. Supply correct parameters before retrying.

Impact and severity

Medium - Tools become unusable after short session duration, requiring gateway restart

Additional information

  • Error first observed: 2026-03-26
  • Frequency: Consistent after ~15 minutes
  • Workaround exists but disrupts workflow
  • exec tool continues to work normally when read/write fail
  • Workaround: Use exec + cat to read files, exec + echo to write files
  • Manual openclaw gateway restart restores read/write functionality
  • Issue is reproducible: happens consistently after ~15 minutes of session activity

extent analysis

Fix Plan

To resolve the issue of read and write tools failing with "Missing required parameter" after approximately 15 minutes of session activity, follow these steps:

  1. Update OpenClaw Configuration: Modify the OpenClaw configuration to increase the session timeout or adjust the parameter validation logic.
  2. Implement Session Refresh: Introduce a mechanism to refresh the session periodically to prevent parameter validation issues.
  3. Adjust Tool Parameter Handling: Update the read and write tools to handle parameters more robustly, potentially by re-validating or re-fetching required parameters.

Example code adjustments for the read tool:

import time

# Assuming a session object is available
session = ...

def read_tool(file_path):
    # Re-validate or re-fetch the file path parameter
    if not file_path or not isinstance(file_path, str):
        # Handle missing or invalid file path
        return {"error": "Missing required parameter: path alias"}

    # Proceed with the read operation
    try:
        # Session refresh logic can be added here if necessary
        # session.refresh()
        with open(file_path, 'r') as file:
            content = file.read()
            return {"content": content}
    except Exception as e:
        return {"error": str(e)}

# Periodic session refresh (example)
def refresh_session_periodically():
    while True:
        # Refresh session logic
        # session.refresh()
        time.sleep(10 * 60)  # Refresh every 10 minutes

# Start the periodic session refresh in the background
import threading
thread = threading.Thread(target=refresh_session_periodically)
thread.daemon = True
thread.start()

Verification

To verify that the fix worked:

  1. Start a new OpenClaw session.
  2. Use the read tool successfully.
  3. Wait for approximately 15 minutes.
  4. Attempt to use the read tool again with the same parameter format.
  5. The tool should now work correctly without reporting "Missing required parameter."

Extra Tips

  • Regularly review and update the OpenClaw configuration and tool implementations to ensure compatibility and robustness.
  • Consider implementing additional logging and monitoring to detect similar issues before they impact users.
  • If using a gateway, ensure it is properly configured and restarted as needed to maintain session integrity.

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

read and write tools should continue to work throughout the session, accepting the file parameter correctly.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: read and write tools fail with "Missing required parameter" after session runs for a while [1 pull requests, 1 comments, 2 participants]