{"record":{"id":"882a93b896b9602f","repo":"google-gemini/gemini-cli","slug":"missing-mount-path-from-listed-in-sandbox-mou","errorCode":null,"errorMessage":"Missing mount path '${from}' listed in SANDBOX_MOUNTS","messagePattern":"Missing mount path '(.+?)' listed in SANDBOX_MOUNTS","errorType":"exception","errorClass":"FatalSandboxError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/sandbox.ts","lineNumber":488,"sourceCode":"\n    // mount paths listed in SANDBOX_MOUNTS\n    if (process.env['SANDBOX_MOUNTS']) {\n      for (let mount of process.env['SANDBOX_MOUNTS'].split(',')) {\n        if (mount.trim()) {\n          // parse mount as from:to:opts\n          let [from, to, opts] = mount.trim().split(':');\n          to = to || from; // default to mount at same path inside container\n          opts = opts || 'ro'; // default to read-only\n          mount = `${from}:${to}:${opts}`;\n          // check that from path is absolute\n          if (!path.isAbsolute(from)) {\n            throw new FatalSandboxError(\n              `Path '${from}' listed in SANDBOX_MOUNTS must be absolute`,\n            );\n          }\n          // check that from path exists on host\n          if (!fs.existsSync(from)) {\n            throw new FatalSandboxError(\n              `Missing mount path '${from}' listed in SANDBOX_MOUNTS`,\n            );\n          }\n          debugLogger.log(`SANDBOX_MOUNTS: ${from} -> ${to} (${opts})`);\n          args.push('--volume', mount);\n        }\n      }\n    }\n\n    // mount paths listed in config.allowedPaths\n    if (config.allowedPaths) {\n      for (const hostPath of config.allowedPaths) {\n        if (hostPath && path.isAbsolute(hostPath) && fs.existsSync(hostPath)) {\n          const containerPath = getContainerPath(hostPath);\n          debugLogger.log(\n            `Config allowedPath: ${hostPath} -> ${containerPath} (ro)`,\n          );\n          args.push('--volume', `${hostPath}:${containerPath}:ro`);","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/utils/sandbox.ts#L470-L506","documentation":"Thrown while parsing SANDBOX_MOUNTS when a mount source path (`from`) is absolute but does not exist on the host filesystem (fs.existsSync returns false). Mounting a nonexistent host path causes Docker to create an empty directory owned by root, which is rarely intended, so it is rejected up front.","triggerScenarios":"SANDBOX_MOUNTS contains an absolute path like /opt/data:/data but /opt/data does not exist on the host. Occurs right after the absolute-path check at sandbox.ts:482.","commonSituations":"Path was correct on a different machine. Typo in the absolute path. The directory is created by a sibling service that hasn't run yet. Mounting a path inside a container that was never bind-created on the host.","solutions":["Create the missing host directory: `mkdir -p /opt/data`.","Correct the path in SANDBOX_MOUNTS to the actual location.","Ensure any service that populates the directory runs before the sandbox starts."],"exampleFix":"// before\n// SANDBOX_MOUNTS=/opt/missing:/data:ro\n\n// after\n// mkdir -p /opt/missing\n// SANDBOX_MOUNTS=/opt/missing:/data:ro","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction ensureMountsExist(mountsStr) {\n  for (const raw of (mountsStr || '').split(',')) {\n    const m = raw.trim();\n    if (!m) continue;\n    const from = m.split(':')[0];\n    if (path.isAbsolute(from) && !fs.existsSync(from)) {\n      fs.mkdirSync(from, {recursive:true});\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provision mount directories in your setup script before launching the sandbox.","Use existence checks in a pre-flight validation step."],"tags":["sandbox","docker","mounts","filesystem","validation"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}