{"record":{"id":"832d3668837b9af1","repo":"paperclipai/paperclip","slug":"codex-working-directory-cannot-be-a-filesystem-roo","errorCode":null,"errorMessage":"Codex working directory cannot be a filesystem root","messagePattern":"Codex working directory cannot be a filesystem root","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts","lineNumber":69,"sourceCode":"  }\n  const requested = resolve(workingDirectory);\n  let resolved: string;\n  try {\n    resolved = realpathSync.native(requested);\n    if (!statSync(resolved).isDirectory()) {\n      throw new Error(\"Codex working directory must be a directory\");\n    }\n  } catch (error) {\n    const code = (error as NodeJS.ErrnoException).code;\n    if (code === \"ENOENT\") {\n      throw new Error(\n        \"Codex working directory must exist before provider admission\",\n      );\n    }\n    throw error;\n  }\n  if (resolved === parse(resolved).root) {\n    throw new Error(\"Codex working directory cannot be a filesystem root\");\n  }\n  const configuredRoot = environment.PAPERCLIP_WORKSPACE_CWD;\n  const hostHome = canonicalConfiguredPath(environment.HOME);\n  if (hostHome && pathContains(resolved, hostHome)) {\n    throw new Error(\"Codex working directory cannot contain the host HOME\");\n  }\n  if (\n    hostHome &&\n    SENSITIVE_HOST_HOME_DIRECTORIES.some((directory) =>\n      pathContains(resolve(hostHome, directory), resolved),\n    )\n  ) {\n    throw new Error(\n      \"Codex working directory cannot overlap sensitive host HOME state\",\n    );\n  }\n  if (\n    hostHome &&","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/drivers/codex/codex-boundaries.ts#L51-L87","documentation":"The validator refuses a working directory that resolves to a filesystem root (e.g. `/` on POSIX). Allowing a provider session to run at the root would expose the entire filesystem to the agent and break the workspace containment model, so root is categorically rejected.","triggerScenarios":"Passing `/` (or `C:\\` on Windows) as the working directory, or a path that resolves to the root after normalization (e.g. `/..`).","commonSituations":"Default fallback values that use the root path; misparsed configuration where a path prefix was stripped leaving only `/`; a sandbox config that dropped the workspace subpath.","solutions":["Point the working directory at a specific workspace subdirectory instead of the root","Fix the config transformation that strips the workspace path prefix","Add a pre-check that rejects root paths before calling the driver"],"exampleFix":"// before\nconst cwd = workspacePath.replace(\"/workspaces\", \"\"); // leaves \"/\" when path IS /workspaces\n// after\nconst cwd = workspacePath.startsWith(\"/workspaces/\") ? workspacePath : `/workspaces/${task.id}`;","handlingStrategy":"validation","validationCode":"import { resolve, parse } from \"node:path\";\nif (resolve(cwd) === parse(resolve(cwd)).root) {\n  throw new Error(\"working directory must not be a filesystem root\");\n}","typeGuard":"function isFilesystemRoot(p: string): boolean {\n  const r = resolve(p);\n  return r === parse(r).root;\n}","tryCatchPattern":"try {\n  validateCodexWorkingDirectory(cwd);\n} catch (err) {\n  if (err.message.includes(\"cannot be a filesystem root\")) {\n    throw new ConfigError(\"workspace path collapsed to root; check path construction\");\n  }\n  throw err;\n}","preventionTips":["Never use bare \"/\" or drive roots as workspace defaults","Join workspace root + task id so the path always has depth","Log the resolved path before validation when debugging path construction"],"tags":["filesystem","security","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}