{"record":{"id":"34d986678c7015be","repo":"yamadashy/repomix","slug":"sandbox-has-no-effect-without-mcp-it-only-con","errorCode":null,"errorMessage":"--sandbox has no effect without --mcp; it only confines the MCP server.","messagePattern":"--sandbox has no effect without --mcp; it only confines the MCP server\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/cli/cliRun.ts","lineNumber":370,"sourceCode":"  } else {\n    logger.setLogLevel(repomixLogLevels.INFO);\n  }\n\n  // In stdout mode, set log level to SILENT\n  if (options.stdout) {\n    logger.setLogLevel(repomixLogLevels.SILENT);\n  }\n\n  // A positional argument can itself be a remote URL, and `options.remote` holds\n  // one by definition, so both are redacted before being dumped.\n  logger.trace('directories:', directories.map(redactUrl));\n  logger.trace('cwd:', cwd);\n  logger.trace('options:', redactOptionsForLog(options));\n\n  const sandboxed = options.sandbox != null && options.sandbox !== false;\n\n  if (sandboxed && !options.mcp) {\n    logger.warn('--sandbox has no effect without --mcp; it only confines the MCP server.');\n  }\n\n  if (options.mcp) {\n    // A string value of --sandbox is the workspace dir to confine to; otherwise use cwd.\n    const requestedRoot = typeof options.sandbox === 'string' ? path.resolve(cwd, options.sandbox) : cwd;\n    // Canonicalize the root so the guard/virtualization/error-scrubbing agree with the\n    // realpaths resolveWithinRoot returns. Runs before any agent connects, so surfacing\n    // the operator's own path in a resolution error is fine.\n    const sandboxRoot = sandboxed ? await canonicalizeSandboxRoot(requestedRoot) : requestedRoot;\n    const { runMcpAction } = await import('./actions/mcpAction.js');\n    return await runMcpAction({ sandboxed, cwd: sandboxRoot });\n  }\n\n  if (options.version) {\n    const { runVersionAction } = await import('./actions/versionAction.js');\n    await runVersionAction();\n    return;\n  }","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/cli/cliRun.ts#L352-L388","documentation":"runCli warns that the --sandbox option was given without --mcp. Sandbox confinement applies only to the spawned MCP server process, so in a normal packing run the flag has no effect and is ignored.","triggerScenarios":"CLI invoked like `repomix --sandbox` (boolean or with a dir) but without `--mcp`, making `sandboxed && !options.mcp` true at src/cli/cliRun.ts:370.","commonSituations":"Users assuming --sandbox restricts file access of the whole packing run; scripts combining flags copied from an MCP example; sandbox default set in config while only running a pack.","solutions":["If you want sandboxing, add --mcp so the MCP server actually runs confined.","If you don't need it, remove --sandbox from the command line or config to silence the warning.","For restricting what gets packed, use include/exclude patterns instead — --sandbox never limits pack scope.","Pass a directory value (`--sandbox <dir>`) together with --mcp to choose the confined workspace root."],"exampleFix":"// before\n$ repomix --sandbox ./workspace\n// after (sandbox actually applies)\n$ repomix --mcp --sandbox ./workspace","handlingStrategy":"validation","validationCode":"if (args.includes('--sandbox') && !args.includes('--mcp')) console.warn('--sandbox requires --mcp to have any effect');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pair --sandbox with --mcp.","Use include/exclude patterns, not --sandbox, to control what gets packed.","Review generated scripts copied from MCP examples for stray flags."],"tags":["cli","sandbox","mcp","flag-usage"],"backgroundTag":"ineffective-cli-flag","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}