{"record":{"id":"acc15619e1a9f3c6","repo":"openclaw/openclaw","slug":"label-file-uri-is-not-valid-for-the-sandbox","errorCode":null,"errorMessage":"${label} file URI is not valid for the sandbox: ${error instanceof Error ? error.message : String(error)}","messagePattern":"(.+?) file URI is not valid for the sandbox: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/codex/src/app-server/sandbox-exec-server/path-uri.ts","lineNumber":31,"sourceCode":"      `${label} must be a valid file URI: ${error instanceof Error ? error.message : String(error)}`,\n      { cause: error },\n    );\n  }\n  if (pathUrl.protocol !== \"file:\") {\n    throw new Error(\n      `${label} URI must use the file scheme, received ${pathUrl.protocol.slice(0, -1)}.`,\n    );\n  }\n  if (pathUrl.search || pathUrl.hash) {\n    throw new Error(`${label} file URI must not include a query or fragment.`);\n  }\n  let resolved: string;\n  try {\n    // The URI names the sandbox target, so decode with POSIX rules even when\n    // the Gateway host is Windows. Docker and SSH backends own POSIX workdirs.\n    resolved = fileURLToPath(pathUrl, { windows: false });\n  } catch (error) {\n    throw new Error(\n      `${label} file URI is not valid for the sandbox: ${error instanceof Error ? error.message : String(error)}`,\n      { cause: error },\n    );\n  }\n  if (WINDOWS_DRIVE_PATH_RE.test(resolved)) {\n    // OpenClaw exec-server backends currently expose Docker/SSH POSIX paths.\n    // Reject foreign drive URIs instead of silently rewriting their meaning.\n    throw new Error(`${label} Windows file URI is not supported by the sandbox.`);\n  }\n  if (resolved.includes(\"\\0\")) {\n    throw new Error(`${label} file URI must not contain a null byte.`);\n  }\n  return resolved;\n}\n","sourceCodeStart":13,"sourceCodeEnd":46,"githubUrl":"https://github.com/openclaw/openclaw/blob/01804a75319da4b69c9ab98ceaa30477e22b8c0b/extensions/codex/src/app-server/sandbox-exec-server/path-uri.ts#L13-L46","documentation":"fileURLToPath threw while decoding the accepted file URI with POSIX rules — the URI is syntactically a URL but its percent-encoding or host component cannot resolve to a sandbox path; the decode error is attached as cause.","triggerScenarios":"Thrown at extensions/codex/src/app-server/sandbox-exec-server/path-uri.ts:31 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Percent-encode path segments correctly (e.g. %20 for spaces)","Avoid percent-encoded NUL, slash, or dot-segment tricks that break decoding","Inspect error.cause for the exact fileURLToPath failure"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01804a75319da4b69c9ab98ceaa30477e22b8c0b","analyzedAt":"2026-08-12T04:37:58.197Z","contentChangedAt":"2026-08-12T04:37:58.197Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}