{"record":{"id":"d098d32e45232103","repo":"different-ai/openwork","slug":"workspace-inaccessible-d098d3","errorCode":"workspace_inaccessible","errorMessage":"Workspace path is not accessible: ${workspacePath}","messagePattern":"Workspace path is not accessible: (.+?)","errorType":"error_code","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/runtime.mjs","lineNumber":254,"sourceCode":"    workspacePath: { value: workspacePath, enumerable: true },\n  });\n  return error;\n}\n\nexport async function prepareRuntimeWorkspaceRoot(projectDir, options = {}) {\n  const rawProjectDir = String(projectDir ?? \"\").trim();\n  try {\n    const workspaceRoot = normalizeWorkspaceRootPath(rawProjectDir, {\n      platform: options.platform ?? process.platform,\n    });\n    if (!workspaceRoot) throw new Error(\"projectDir is required\");\n    await (options.mkdirImpl ?? mkdir)(workspaceRoot, { recursive: true });\n    if (typeof options.ensureConfig === \"function\") {\n      await options.ensureConfig(workspaceRoot);\n    }\n    return workspaceRoot;\n  } catch (error) {\n    throw workspaceInaccessibleError(rawProjectDir, error);\n  }\n}\n\nexport function resolveOpenworkServerConfigPath(env = process.env) {\n  return openworkServerConfigPath({ env });\n}\n\nexport function seedWorkspacePathsForEmbeddedServer(workspacePaths, serverConfigExists) {\n  return serverConfigExists ? [] : workspacePaths;\n}\n\nexport function selectStickyOpenworkPortWorkspace(requestedWorkspacePaths = [], serverWorkspacePaths = []) {\n  for (const value of [...requestedWorkspacePaths, ...serverWorkspacePaths]) {\n    const workspacePath = String(value ?? \"\").trim();\n    if (workspacePath) return workspacePath;\n  }\n  return \"\";\n}","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/runtime.mjs#L236-L272","documentation":"prepareRuntimeWorkspaceRoot normalizes the project directory, mkdir -p's it, and optionally writes config; any failure is wrapped by workspaceInaccessibleError into code 'workspace_inaccessible' with the message 'Workspace path is not accessible: <path>'. The library throws it to fail fast when the workspace root cannot be created or prepared instead of booting a runtime on a broken path.","triggerScenarios":"Calling prepareRuntimeWorkspaceRoot(projectDir) where normalizeWorkspaceRootPath rejects the path, mkdir fails (EACCES, EROFS, ENOSPC, path is a file), or the injected ensureConfig callback throws.","commonSituations":"Workspace pointing at a read-only mount or network share that is unmounted; parent directory owned by another user; passing a file path instead of a directory; disk quota exceeded; project dir on a drive that no longer exists.","solutions":["Inspect error.cause for the underlying fs code (EACCES/EROFS/ENOENT/ENOSPC) and fix that condition.","Verify the path exists, is a directory, and is writable by the app user (ls -ld, touch a test file).","Fix ownership/permissions (chown/chmod) or move the workspace to a writable location.","If a custom ensureConfig was injected, run it manually to see its failure."],"exampleFix":"// before\nconst root = await prepareRuntimeWorkspaceRoot(\"/mnt/share/project\"); // read-only mount\n// after\nimport { access, constants } from \"node:fs/promises\";\ntry { await access(\"/mnt/share/project\", constants.W_OK); } catch (e) { throw new Error(\"Fix workspace permissions/mount before boot: \" + e.code); }\nconst root = await prepareRuntimeWorkspaceRoot(\"/mnt/share/project\");","handlingStrategy":"validation","validationCode":"import { stat, access, constants } from \"node:fs/promises\";\nconst s = await stat(projectDir).catch(() => null);\nif (!s?.isDirectory()) throw new Error(`${projectDir} is not a directory`);\nawait access(projectDir, constants.W_OK); // throws EACCES before runtime boot","typeGuard":"async function isWritableWorkspaceDir(p) {\n  try {\n    const s = await stat(p);\n    if (!s.isDirectory()) return false;\n    await access(p, constants.W_OK);\n    return true;\n  } catch { return false; }\n}","tryCatchPattern":"try {\n  await prepareRuntimeWorkspaceRoot(projectDir);\n} catch (e) {\n  if (e?.code === \"workspace_inaccessible\") {\n    console.error(`Workspace ${e.workspacePath} unusable: ${e.cause?.code ?? e.cause?.message}`);\n    return;\n  }\n  throw e;\n}","preventionTips":["Stat + access(W_OK) the workspace before booting the runtime.","Catch and inspect error.cause.code (EACCES/EROFS/ENOSPC) for a targeted fix.","Keep workspaces on local writable volumes, not read-only or flaky network mounts.","Ensure custom ensureConfig callbacks throw actionable messages."],"tags":["workspace","filesystem","permissions"],"backgroundTag":"workspace-path-not-accessible","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}