openclaw - ✅(Solved) Fix [Bug]: Write failed error shown but file actually saved successfully (100% success rate) [1 pull requests, 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#55424Fetched 2026-04-08 01:39:39
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×2cross-referenced ×1referenced ×1

Write failed / Edit failed 错误提示频繁出现,但实际文件 100% 写入成功。这是 OpenClaw 工具层响应超时问题,不是文件系统问题。

Root Cause

Write failed / Edit failed 错误提示频繁出现,但实际文件 100% 写入成功。这是 OpenClaw 工具层响应超时问题,不是文件系统问题。

Fix Action

Fixed

PR fix notes

PR #55444: fix: suppress write/edit failed warning for response timeout errors

Description (problem / solution / changelog)

Summary

  • Fixes #55424: "Write failed" / "Edit failed" warning shown to users even though the file was actually saved successfully
  • When tool response times out at the ack layer, the write has already completed on disk — the timeout-based isError=true was incorrectly triggering a mutating-tool warning
  • Added isToolResponseTimeoutError() check in resolveToolErrorWarningPolicy() to suppress warnings for timeout errors on mutating tools, since the operation likely succeeded

Test plan

  • Added parameterized tests for write/edit timeout suppression (invoke timed out, Response timeout, connection timed out waiting for response)
  • Added test confirming non-timeout mutating errors (e.g. disk full) still show warnings
  • Updated existing test case that used write + connection timeout (now correctly suppressed)
  • All 33 error tests pass (pnpm test -- src/agents/pi-embedded-runner/run/payloads.errors.test.ts)
  • All 8 main payload tests pass (pnpm test -- src/agents/pi-embedded-runner/run/payloads.test.ts)

Changed files

  • src/agents/pi-embedded-runner/run/payloads.errors.test.ts (modified, +23/-2)
  • src/agents/pi-embedded-runner/run/payloads.ts (modified, +11/-0)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Beta release blocker

No

Summary

Write failed / Edit failed 错误提示频繁出现,但实际文件 100% 写入成功。这是 OpenClaw 工具层响应超时问题,不是文件系统问题。

Steps to reproduce

  1. 使用 OpenClaw 写入文件(write 或 edit 工具)
  2. 观察飞书界面底部显示"Write failed"错误提示
  3. 验证文件实际状态(Test-Path + Get-Item)
  4. 结果显示文件已成功写入(100% 成功率)

错误时间线(8 次错误,100% 成功):

  • 05:44 - Write failed ✅ 成功
  • 06:16 - Write failed ✅ 成功
  • 06:33 - Write failed ✅ 成功
  • 06:46 - Edit failed ✅ 成功
  • 06:52 - Write failed ✅ 成功
  • 06:56 - Edit failed ✅ 成功
  • 06:56 - Edit failed ✅ 成功
  • 07:30 - Write failed ✅ 成功

Expected behavior

工具应该正确显示文件写入状态,成功时显示成功提示,失败时显示失败提示。

Actual behavior

飞书界面底部显示"⚠️ Write failed"错误提示,但文件实际已成功写入(通过 Test-Path 和 Get-Item 验证,8 次错误,8 次成功,成功率 100%)。

OpenClaw version

2026.3.13

Operating system

Windows 11

Install method

npm global

Model

bailian/qwen3.5-plus

Provider / routing chain

openclaw -> bailian

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

受影响:所有使用 OpenClaw 写入文件的用户 严重程度:中等(不影响实际功能,但造成用户困惑) 频率:106 分钟内 8 次 后果:用户看到错误提示但文件实际成功写入,可能导致用户不信任工具状态

Additional information

已创建临时解决方案:

  • scripts/reliable-write.ps1 - 可靠写入脚本
  • scripts/tool-wrapper.ps1 - 工具包装器

建议修复:

  1. 检查工具执行器的超时设置
  2. 增加超时时间或重试机制
  3. 改进状态同步逻辑
  4. 添加写入后验证机制

extent analysis

Fix Plan

To address the OpenClaw tool layer response timeout issue, we will:

  • Increase the timeout setting in the tool executor
  • Implement a retry mechanism for write operations
  • Enhance the status synchronization logic
  • Add a post-write validation mechanism

Example Code

Here's an example of how you can implement these changes:

# Increase timeout setting
$timeout = 30000 # 30 seconds

# Implement retry mechanism
function Retry-Write {
  param ($file, $content)
  $retryCount = 0
  $maxRetries = 3
  while ($retryCount -lt $maxRetries) {
    try {
      # Write file content
      Set-Content -Path $file -Value $content -ErrorAction Stop
      return $true
    } catch {
      $retryCount++
      Start-Sleep -Milliseconds 1000
    }
  }
  return $false
}

# Enhance status synchronization logic
function Sync-Status {
  param ($file)
  # Validate file existence and content
  if (Test-Path -Path $file) {
    $fileContent = Get-Content -Path $file
    # Update tool status
    Update-ToolStatus -Status "Success" -Message "File written successfully"
  } else {
    # Update tool status
    Update-ToolStatus -Status "Failed" -Message "File write failed"
  }
}

# Add post-write validation mechanism
function Validate-Write {
  param ($file, $expectedContent)
  # Validate file content
  $fileContent = Get-Content -Path $file
  if ($fileContent -eq $expectedContent) {
    return $true
  } else {
    return $false
  }
}

Verification

To verify that the fix worked, you can:

  • Run the Retry-Write function with a sample file and content
  • Validate the file existence and content using Test-Path and Get-Content
  • Check the tool status using Update-ToolStatus
  • Run the Validate-Write function to ensure the file content matches the expected content

Extra Tips

  • Make sure to adjust the timeout setting and retry count according to your specific requirements
  • Consider adding logging and error handling mechanisms to the Retry-Write and Validate-Write functions
  • Test the changes thoroughly to ensure they do not introduce any regressions or side effects.

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

工具应该正确显示文件写入状态,成功时显示成功提示,失败时显示失败提示。

Still need to ship something?

×6

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

Back to top recommendations

TRENDING