From 1c92aaf5d7c0e9f6cb06b873ee8fdd5565a43fc0 Mon Sep 17 00:00:00 2001 From: kumarabhirup Date: Sun, 15 Mar 2026 04:29:07 -0700 Subject: [PATCH] fix(bootstrap): create workspace dir before setting openclaw config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On fresh Linux installs (e.g. running as root), `openclaw config set agents.defaults.workspace` fails because the target directory doesn't exist yet — some OpenClaw builds validate the path on disk before accepting the value. Create the directory eagerly with mkdirSync before the config set call. Also surface the exit code in runOpenClawOrThrow errors when stderr is empty, so silent failures are easier to diagnose. Fixes #101 --- src/cli/bootstrap-external.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/cli/bootstrap-external.ts b/src/cli/bootstrap-external.ts index d90e8f05dfc..d83315b2549 100644 --- a/src/cli/bootstrap-external.ts +++ b/src/cli/bootstrap-external.ts @@ -747,7 +747,10 @@ async function runOpenClawOrThrow(params: { return result; } const detail = firstNonEmptyLine(result.stderr, result.stdout); - throw new Error(detail ? `${params.errorMessage}\n${detail}` : params.errorMessage); + const parts = [params.errorMessage]; + if (detail) parts.push(detail); + else if (result.code != null) parts.push(`(exit code ${result.code})`); + throw new Error(parts.join("\n")); } /** @@ -770,7 +773,10 @@ async function runOpenClawInteractiveOrThrow(params: { return result; } const detail = firstNonEmptyLine(result.stderr, result.stdout); - throw new Error(detail ? `${params.errorMessage}\n${detail}` : params.errorMessage); + const parts = [params.errorMessage]; + if (detail) parts.push(detail); + else if (result.code != null) parts.push(`(exit code ${result.code})`); + throw new Error(parts.join("\n")); } /** @@ -2223,6 +2229,9 @@ export async function bootstrapCommand( // Pin OpenClaw to the managed default workspace before onboarding so bootstrap // never drifts into creating/using legacy workspace-* paths. + // The directory must exist before `openclaw config set` — some OpenClaw builds + // validate the workspace path on disk before accepting the value. + mkdirSync(workspaceDir, { recursive: true }); preCloudSpinner?.message("Configuring default workspace…"); await ensureDefaultWorkspacePath(openclawCommand, profile, workspaceDir);