openclaw - ✅(Solved) Fix [Bug]: Migration guide missing cross-OS path rewrite step, openclaw doctor does not detect stale absolute workspace paths [2 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#63572Fetched 2026-04-10 03:42:44
View on GitHub
Comments
1
Participants
2
Timeline
8
Reactions
0
Timeline (top)
referenced ×3cross-referenced ×2labeled ×2commented ×1

Migration guide does not warn about hardcoded absolute paths in openclaw.json breaking when migrating between different OS environments (e.g. Linux/WSL to macOS)

Error Message

05:34:22+00:00 error gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} telegram bot error: Error: ENOENT: no such file or directory, mkdir '/home/<username>' at Object.mkdir (node:internal/fs/promises:852:10) at ensureAgentWorkspace (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/workspace-Q6iYWMyk.js:256:2) at getReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/reply-DW8PLbAC.js:3079:130) at dispatchReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:590:23) at withReplyDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:918:10) at dispatchInboundMessage (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:930:9) at dispatchInboundMessageWithBufferedDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:944:10) at Object.dispatchReplyWithBufferedBlockDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/provider-dispatcher-COjV0JaB.js:4:9) at file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/bot-DMS2hpfD.js:1317:5 at /Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/node_modules/grammy/out/composer.js:578:13

Root Cause

Gateway fails with ENOENT errors because openclaw.json still contains Linux-style absolute paths (/home/username/.openclaw/workspace) that don't exist on macOS (/Users/username/.openclaw/workspace). No warning is given by openclaw doctor.

Fix Action

Fix / Workaround

05:34:22+00:00 error gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} telegram bot error: Error: ENOENT: no such file or directory, mkdir '/home/<username>'
    at Object.mkdir (node:internal/fs/promises:852:10)
    at ensureAgentWorkspace (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/workspace-Q6iYWMyk.js:256:2)
    at getReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/reply-DW8PLbAC.js:3079:130)
    at dispatchReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:590:23)
    at withReplyDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:918:10)
    at dispatchInboundMessage (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:930:9)
    at dispatchInboundMessageWithBufferedDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:944:10)
    at Object.dispatchReplyWithBufferedBlockDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/provider-dispatcher-COjV0JaB.js:4:9)
    at file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/bot-DMS2hpfD.js:1317:5
    at /Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/node_modules/grammy/out/composer.js:578:13

PR fix notes

PR #63595: fix(workspace): surface cross-OS migration hint on ENOENT mkdir failure

Description (problem / solution / changelog)

Summary

When users migrate an OpenClaw state directory between Linux/WSL and macOS (or vice versa), openclaw.json still references absolute workspace paths from the original host — commonly /home/<user>/.openclaw/workspace on a host where home is actually /Users/<user>.

ensureAgentWorkspace() calls fs.mkdir(dir, { recursive: true }) on the stale path and fails with a raw ENOENT: no such file or directory, mkdir '/home/<user>' in the gateway error log, because /home is not a writable location for non-root users on macOS. Agents silently fail on every inbound message with no visible hint that the root cause is a stale absolute path in config.

Fixes #63572

Reporter's stack trace (from #63572)

error gateway/channels/telegram telegram bot error:
  Error: ENOENT: no such file or directory, mkdir '/home/<username>'
    at Object.mkdir (node:internal/fs/promises:852:10)
    at ensureAgentWorkspace (workspace-Q6iYWMyk.js:256:2)
    at getReplyFromConfig (reply-DW8PLbAC.js:3079:130)
    at dispatchReplyFromConfig (dispatch-BvwlsDx2.js:590:23)
    ...

The dist/workspace-Q6iYWMyk.js:256 line corresponds to src/agents/workspace.ts:340 — the fs.mkdir(dir, { recursive: true }) call inside ensureAgentWorkspace.

Fix

Catch ENOENT from the initial mkdir and, if the path pattern looks like a cross-OS home-prefix mismatch (/home/<user> on a host with /Users/... home, or vice versa), throw a new Error that explicitly names:

  1. The failing path
  2. The current host's home
  3. The exact config key (agents.defaults.workspace) the user must update
  4. The alternative (openclaw setup to reset)

The original error is preserved as cause for debugging. Non-cross-OS ENOENTs still surface the original error unchanged, so unrelated permission/filesystem failures are not masked.

The detection logic is extracted into an exported pure function buildCrossOsWorkspaceMigrationHint(dir, home) so the behaviour can be unit-tested without touching the real filesystem.

Why error-message, not auto-rewrite

An earlier option considered was to silently rewrite the stale path to the current user's home. Rejected because:

  • Could corrupt intentional cross-user or shared workspace setups
  • Silent mutation of config files is a trust violation
  • A clear, actionable error lets the user decide: update the path, reset via openclaw setup, or symlink the directory

Tests

Added describe(\"buildCrossOsWorkspaceMigrationHint (#63572)\") block with 6 cases in src/agents/workspace.test.ts:

  1. Linux home prefix on macOS host → hint emitted, mentions /home/alice, "macOS", and agents.defaults.workspace
  2. macOS home prefix on Linux host → hint emitted, mentions /Users/bob, "Linux", and agents.defaults.workspace
  3. Workspace already under current homenull (no false-positive on happy path)
  4. Bespoke workspace outside any home tree (e.g. /srv/shared/..., /opt/...) → null (not a migration issue)
  5. Empty inputsnull (defensive)
  6. Same-OS different-user shared workspacenull (could be intentional, avoid misleading hint)

Scope

  • 2 files touched, +122 / -1
  • One new exported helper (buildCrossOsWorkspaceMigrationHint) for testability
  • One new try/catch around the existing fs.mkdir call
  • Zero changes to the happy path (workspace creation succeeds unchanged)
  • Zero changes to the ensureBootstrapFiles logic downstream of mkdir

Credit to @davidperjac for the detailed repro and full stack trace in the issue.

Changed files

  • src/agents/workspace.test.ts (modified, +58/-0)
  • src/agents/workspace.ts (modified, +64/-1)

PR #63803: fix(doctor): detect stale cross-OS workspace paths (#63572)

Description (problem / solution / changelog)

Summary

Closes #63572.

When a user migrates their ~/.openclaw state directory across OSes (WSL/Linux → macOS, for example), any absolute paths persisted in openclaw.json for agents.defaults.workspace or per-agent workspace fields break silently. ensureAgentWorkspace later tries to mkdir -p the stale Linux path on a macOS host and fails with ENOENT, taking down every channel's agent dispatch with only gateway-log evidence.

This PR adds a new doctor health contribution — doctor:workspace-stale-paths — that detects these stale paths and offers to rewrite them to ~-relative form, which is durable across future migrations.

What changed

  • New: src/commands/doctor-workspace-paths.ts — pure detectStaleWorkspacePaths(cfg, env) detector plus an effectful maybeRepairStaleWorkspacePaths(cfg, prompter, options) wrapper that matches the existing maybeRepairX pattern used elsewhere in doctor.
  • New: src/commands/doctor-workspace-paths.test.ts — 14 unit tests covering: empty config, tilde passthrough, relative paths, existing-absolute passthrough, Linux→macOS, macOS→Linux, Windows→macOS, different-user same-OS, /root for non-root users, non-home absolute as missing-nonhome, nested subpath preservation, bare home root → ~, mixed healthy + stale agent list, and local-missing-same-home skip.
  • Modified: src/flows/doctor-health-contributions.ts — register the new contribution immediately after doctor:workspace-status so mutations land before doctor:write-config persists.
  • Modified: docs/install/migrating.md — new "Cross-OS absolute workspace paths" accordion under Common Pitfalls pointing at the new check.
  • Modified: CHANGELOG.md — one line at the end of Unreleased > ### Fixes.

Detection rules

InputOutcome
Empty, missing, or ~-prefixedSkip
Relative pathSkip
Home-shaped absolute path that exists on this hostSkip
Home-shaped absolute path, our user, our home matches, but missing locallySkip — the existing doctor:workspace-status already covers local-missing; we avoid duplicate noise
Home-shaped absolute path (/home/X, /Users/X, /root, C:\Users\X), different user or wrong home rootFlag stale-home-prefix, propose ~-relative rewrite
Non-home absolute path (/mnt/data/ws), doesn't existReport missing-nonhome, never auto-rewrite

Home-shaped paths are inspected regardless of the current platform — a Windows-shaped path encountered on a macOS host is exactly the cross-OS case we want to catch.

Behavior

  • Interactive mode: single confirmation prompt listing all stale paths and their proposed rewrites. On yes, mutates ctx.cfg; the existing doctor:write-config contribution persists the result on the same pass.
  • Non-interactive mode (openclaw doctor --non-interactive): logs findings and manual-fix instructions, does not mutate.

Scope boundaries (explicitly out of scope)

  • Does not touch gateway.staticDir, sandbox.workspaceRoot, or any other absolute-path config field. The reporter named only the agent workspace fields and expanding scope risks rewriting intentionally-absolute mounts.
  • Does not change ensureAgentWorkspace or resolveAgentWorkspaceDir. Strict diagnose-and-repair at the doctor layer, matching the CLAUDE.md guidance ("for legacy config specifically, prefer doctor-owned repair paths over startup/load-time core migrations").
  • Does not rewrite the migration guide — single accordion addition only.

Why ~ rather than absolute homedir

The reporter's failure mode is "stale absolute path after migration". Rewriting to another absolute path (for example the current /Users/me/...) just pushes the problem to the next migration. Writing ~/.openclaw/... keeps the config portable.

Test plan

  • pnpm test src/commands/doctor-workspace-paths.test.ts — 14/14 passing
  • pnpm test src/commands/doctor — 116/116 passing across 24 test files in the broader doctor suite, no regressions
  • pnpm format — clean (no formatting churn in touched files)
  • pnpm lint scoped to touched files (src/commands/doctor-workspace-paths*.ts and src/flows/doctor-health-contributions.ts) — 0 errors, 0 warnings
  • Pre-commit hook fast lane (FAST_COMMIT=1) — clean
  • Manual verification with a synthetic openclaw.json containing /home/<alt-user>/.openclaw/workspace on a macOS host — happy to do in a follow-up if a reviewer wants a live trace

Note on pnpm check

The full pnpm check gate halts on a pre-existing unrelated tsgo error in src/auto-reply/reply/followup-runner.test.ts:1140 (type cast from a literal config shape to OpenClawConfig rejected by the current CliBackendConfig index signature). I verified the error is present on origin/main with no changes applied, so it does not belong to this PR. My touched files type-check cleanly in isolation. Happy to adjust if a maintainer would prefer the check-gate-green requirement blocks landing here.

Co-Authored-By: Oz [email protected]

Changed files

  • CHANGELOG.md (modified, +1/-0)
  • docs/install/migrating.md (modified, +4/-0)
  • src/commands/doctor-workspace-paths.test.ts (added, +172/-0)
  • src/commands/doctor-workspace-paths.ts (added, +312/-0)
  • src/flows/doctor-health-contributions.ts (modified, +12/-0)

Code Example

05:34:22+00:00 error gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} telegram bot error: Error: ENOENT: no such file or directory, mkdir '/home/<username>'
    at Object.mkdir (node:internal/fs/promises:852:10)
    at ensureAgentWorkspace (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/workspace-Q6iYWMyk.js:256:2)
    at getReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/reply-DW8PLbAC.js:3079:130)
    at dispatchReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:590:23)
    at withReplyDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:918:10)
    at dispatchInboundMessage (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:930:9)
    at dispatchInboundMessageWithBufferedDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:944:10)
    at Object.dispatchReplyWithBufferedBlockDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/provider-dispatcher-COjV0JaB.js:4:9)
    at file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/bot-DMS2hpfD.js:1317:5
    at /Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/node_modules/grammy/out/composer.js:578:13
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Migration guide does not warn about hardcoded absolute paths in openclaw.json breaking when migrating between different OS environments (e.g. Linux/WSL to macOS)

Steps to reproduce

Steps to reproduce:

  1. Set up OpenClaw on WSL/Linux where workspace paths default to /home/username/.openclaw/workspace
  2. Follow the migration guide to move state directory to a macOS machine or other host
  3. Run openclaw doctor and openclaw gateway restart
  4. Send a message via Telegram
  5. Observe ENOENT: no such file or directory, mkdir '/home/username' in gateway logs

Expected behavior

Either openclaw doctor detects and rewrites stale absolute paths during migration, or the migration guide explicitly lists path updates as a required step for cross-OS migrations.

Actual behavior

Gateway fails with ENOENT errors because openclaw.json still contains Linux-style absolute paths (/home/username/.openclaw/workspace) that don't exist on macOS (/Users/username/.openclaw/workspace). No warning is given by openclaw doctor.

OpenClaw version

2026.4.8

Operating system

Migrated from WSL2 Ubuntu 24.04 to macOS 26.2 (arm64)

Install method

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

Model

minimax-portal/MiniMax-M2.7

Provider / routing chain

openclaw -> minimax-portal

Additional provider/model setup details

No response

Logs, screenshots, and evidence

05:34:22+00:00 error gateway/channels/telegram {"subsystem":"gateway/channels/telegram"} telegram bot error: Error: ENOENT: no such file or directory, mkdir '/home/<username>'
    at Object.mkdir (node:internal/fs/promises:852:10)
    at ensureAgentWorkspace (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/workspace-Q6iYWMyk.js:256:2)
    at getReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/reply-DW8PLbAC.js:3079:130)
    at dispatchReplyFromConfig (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:590:23)
    at withReplyDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:918:10)
    at dispatchInboundMessage (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:930:9)
    at dispatchInboundMessageWithBufferedDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/dispatch-BvwlsDx2.js:944:10)
    at Object.dispatchReplyWithBufferedBlockDispatcher (file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/provider-dispatcher-COjV0JaB.js:4:9)
    at file:///Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/dist/bot-DMS2hpfD.js:1317:5
    at /Users/<username>/.local/share/fnm/node-versions/v22.16.0/installation/lib/node_modules/openclaw/node_modules/grammy/out/composer.js:578:13

Impact and severity

  • Affected: Any user migrating between Linux/WSL and macOS (or vice versa)
  • Severity: High, blocks all agent functionality silently
  • Frequency: 100% when migrating cross-OS with default workspace paths
  • Consequence: Agents fail to respond on all channels, error only visible in gateway logs

Additional information

The fix is either adding a step to the migration guide about updating absolute paths in openclaw.json, or having openclaw doctor detect paths referencing non-existent home directories and offer to rewrite them to the current user's home. The agents.defaults.workspace and per-agent workspace fields in openclaw.json are the affected keys.

extent analysis

TL;DR

Update the openclaw.json file to use relative paths or the correct absolute paths for the target operating system to fix the issue.

Guidance

  • Identify the affected keys in openclaw.json, specifically agents.defaults.workspace and per-agent workspace fields, and update them to use relative paths or the correct absolute paths for the target operating system.
  • Consider adding a step to the migration guide to inform users about the need to update these paths when migrating between different OS environments.
  • Run openclaw doctor after updating the paths to ensure that the configuration is valid and the issue is resolved.
  • Verify that the agents are functioning correctly by sending a test message via Telegram and checking the gateway logs for any errors.

Example

No code example is provided as the issue is related to configuration file updates.

Notes

The issue is specific to migrations between Linux/WSL and macOS, and the fix involves updating the openclaw.json file to use correct paths for the target operating system.

Recommendation

Apply a workaround by updating the openclaw.json file manually, as the current version of OpenClaw (2026.4.8) does not automatically detect and rewrite stale absolute paths during migration.

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

Either openclaw doctor detects and rewrites stale absolute paths during migration, or the migration guide explicitly lists path updates as a required step for cross-OS migrations.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING