-
-
Notifications
You must be signed in to change notification settings - Fork 69.5k
[Bug]: read tool prepends workspace root to absolute Windows paths, producing doubled paths #54039
Description
Bug type
Behavior bug (incorrect output/state without crash)
Summary
Title:
read tool prepends workspace root to absolute Windows paths, producing doubled paths
Description template:
``
Environment
OpenClaw version: (check openclaw.json meta.lastTouchedVersion or run openclaw --version)
OS: Windows 11 Pro
Workspace path: C:\Users\Dan.openclaw\workspace
What happened
When the agent constructs an absolute Windows path and passes it to the read tool,
the tool prepends the workspace root rather than treating the path as absolute.
Example observed path in error log:
C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspace\HEARTBEAT.md
The path was produced by joining:
workspace root: C:\Users\Dan.openclaw\workspace
agent-supplied: C:\Users\Dan.openclaw\workspace\HEARTBEAT.md
result: C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspace\HEARTBEAT.md
A second variant appeared where the full drive letter was preserved:
C:\Users\Dan.openclaw\workspace:C:\Users\Dan.openclaw\workspace\HEARTBEAT.md
Expected behavior
When the path supplied to read is an absolute Windows path (begins with a drive
letter followed by :), the tool should use it as-is without joining it to the
workspace root.
Workaround applied
Updated all prompts and cron job messages to use workspace-relative paths only.
The bug is still present in the tool layer for any future case where an agent
independently constructs an absolute path.
Relevant log entries
12:58:11 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspace\HEARTBEAT.md'
12:58:11 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspa'
12:58:24 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspace\HEARTBEAT.md'
12:58:24 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspace\memory\tasks.json'
12:58:28 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:C:\Users\Dan.openclaw\workspace\HEARTBEAT.md'
12:58:28 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:C:\Users\Dan.openclaw\workspace\memory\tasks.json'
Steps to reproduce
- Configure OpenClaw with a workspace path, e.g. C:\Users\Dan.openclaw\workspace
- Create a cron job or heartbeat prompt whose message text references a workspace file using
its absolute path, e.g.: "Read the file C:\Users\Dan.openclaw\workspace\HEARTBEAT.md and
follow its instructions." - Trigger the job or heartbeat
- The agent, following the prompt literally, calls the read tool passing the absolute path
C:\Users\Dan.openclaw\workspace\HEARTBEAT.md - Observe the log entry: read failed: ENOENT: no such file or directory, access
'C:\Users\Dan.openclaw\workspace:\Users\Dan.openclaw\workspace\HEARTBEAT.md'
Expected behavior
When the path argument to read begins with a Windows drive letter and colon (C:), the tool
should recognize it as an already-absolute path and use it without modification. The file at
C:\Users\Dan.openclaw\workspace\HEARTBEAT.md should be read successfully.
The bug produces two distinct malformed variants depending on how the path join is implemented internally. This may help you locate the exact code path:
- Variant A: workspace\ + :\Users... — the C was stripped, leaving the colon as a bare
directory name - Variant B: workspace\ + :C:\Users... — the full path including drive letter was appended
after a colon separator
Both variants appeared in the same session within seconds of each other, suggesting the agent
retried with a slightly different path form on the second attempt.
Actual behavior
See Summary
OpenClaw version
2026.3.23
Operating system
Windows 11 Pro
Install method
npm global
Model
moonshot/kimi-k2
Provider / routing chain
OpenClaw agent (LLM response) → Gateway tool dispatcher ([tools] log prefix) → read tool path resolver ← bug is here → Node.js fs (fs.access / fs.readFile) The path resolver is the only hop where the doubling can happen — it receives the absolute path the agent constructed, joins it to the workspace root, and hands the malformed result to Node.js fs. No network call is involved; the entire chain is local.
Additional provider/model setup details
No response
Logs, screenshots, and evidence
12:58:11 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan\.openclaw\workspace\:\Users\Dan\.openclaw\workspace\HEARTBEAT.md'
12:58:11 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan\.openclaw\workspace\:\Users\Dan\.openclaw\workspa'
12:58:24 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan\.openclaw\workspace\:\Users\Dan\.openclaw\workspace\HEARTBEAT.md'
12:58:24 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan\.openclaw\workspace\:\Users\Dan\.openclaw\workspace\memory\tasks.json'
12:58:28 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan\.openclaw\workspace\:C:\Users\Dan\.openclaw\workspace\HEARTBEAT.md'
12:58:28 [tools] read failed: ENOENT: no such file or directory, access
'C:\Users\Dan\.openclaw\workspace\:C:\Users\Dan\.openclaw\workspace\memory\tasks.json'Impact and severity
No response
Additional information
No response