openclaw - 💡(How to fix) Fix openclaw devices list times out under live-write races in device store

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…
  • Plugin: device-pair enabled with active config
  • Pattern: reproducible whenever openclaw devices list is called while device writes may be in flight
  • Impact: openclaw devices approve and related device management commands are blocked

Error Message

The error occurs even after cleanup of stale .tmp orphans, suggesting the race is in the canonical write path, not from orphans.

Observed Error

"error": "JsonFileReadError",

Root Cause

The device store's atomic-file reader appears to have a race condition with the live-write path. When the reader's mtime/inode guard detects the file changing during the read operation, it rejects the operation as potentially corrupt. This is a safety measure, but it causes the CLI request to hang indefinitely until timeout.

The error occurs even after cleanup of stale .tmp orphans, suggesting the race is in the canonical write path, not from orphans.

Code Example

{
  "error": "JsonFileReadError",
  "filePath": "~/.openclaw/devices/paired.json",
  "cause": "File changed during read"
}
RAW_BUFFERClick to expand / collapse

Symptom

openclaw devices list command times out at 10 seconds (max wait). Gateway logs show JsonFileReadError on paired.json read path.

Root Cause

The device store's atomic-file reader appears to have a race condition with the live-write path. When the reader's mtime/inode guard detects the file changing during the read operation, it rejects the operation as potentially corrupt. This is a safety measure, but it causes the CLI request to hang indefinitely until timeout.

The error occurs even after cleanup of stale .tmp orphans, suggesting the race is in the canonical write path, not from orphans.

Environment

  • Gateway: 2026.5.18 (50a2481)
  • Device store: ~/.openclaw/devices/paired.json (~31 KB, healthy structure)
  • OS: Linux Mint 21.3
  • Node: 24.15.0

Observed Error

{
  "error": "JsonFileReadError",
  "filePath": "~/.openclaw/devices/paired.json",
  "cause": "File changed during read"
}

Context

  • Plugin: device-pair enabled with active config
  • Pattern: reproducible whenever openclaw devices list is called while device writes may be in flight
  • Impact: openclaw devices approve and related device management commands are blocked

Suggested Fix

Investigate the write path of the device store:

  • Current: appears to use atomic replacement (rename temp file → final file) with mtime/inode guards on the read side
  • Candidate improvements:
    • Copy-on-write snapshot: let readers get a stable snapshot while writers work on a shadow copy
    • Read-while-locked: hold a lock during write, snapshot before releasing, allow readers to access the snapshot
    • Backoff + retry: add exponential backoff to the reader when mtime/inode change is detected, rather than failing immediately

References

Related: issue tracking stale .tmp orphans (Issue #84750)

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…

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 - 💡(How to fix) Fix openclaw devices list times out under live-write races in device store