yamadashy/repomix · info

--sandbox has no effect without --mcp; it only confines the

Error message

--sandbox has no effect without --mcp; it only confines the MCP server.

What it means

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.

Source

Thrown at src/cli/cliRun.ts:370

  } else {
    logger.setLogLevel(repomixLogLevels.INFO);
  }

  // In stdout mode, set log level to SILENT
  if (options.stdout) {
    logger.setLogLevel(repomixLogLevels.SILENT);
  }

  // A positional argument can itself be a remote URL, and `options.remote` holds
  // one by definition, so both are redacted before being dumped.
  logger.trace('directories:', directories.map(redactUrl));
  logger.trace('cwd:', cwd);
  logger.trace('options:', redactOptionsForLog(options));

  const sandboxed = options.sandbox != null && options.sandbox !== false;

  if (sandboxed && !options.mcp) {
    logger.warn('--sandbox has no effect without --mcp; it only confines the MCP server.');
  }

  if (options.mcp) {
    // A string value of --sandbox is the workspace dir to confine to; otherwise use cwd.
    const requestedRoot = typeof options.sandbox === 'string' ? path.resolve(cwd, options.sandbox) : cwd;
    // Canonicalize the root so the guard/virtualization/error-scrubbing agree with the
    // realpaths resolveWithinRoot returns. Runs before any agent connects, so surfacing
    // the operator's own path in a resolution error is fine.
    const sandboxRoot = sandboxed ? await canonicalizeSandboxRoot(requestedRoot) : requestedRoot;
    const { runMcpAction } = await import('./actions/mcpAction.js');
    return await runMcpAction({ sandboxed, cwd: sandboxRoot });
  }

  if (options.version) {
    const { runVersionAction } = await import('./actions/versionAction.js');
    await runVersionAction();
    return;
  }

View on GitHub (pinned to f465ad9093)

Solutions

  1. If you want sandboxing, add --mcp so the MCP server actually runs confined.
  2. If you don't need it, remove --sandbox from the command line or config to silence the warning.
  3. For restricting what gets packed, use include/exclude patterns instead — --sandbox never limits pack scope.
  4. Pass a directory value (`--sandbox <dir>`) together with --mcp to choose the confined workspace root.

Example fix

// before
$ repomix --sandbox ./workspace
// after (sandbox actually applies)
$ repomix --mcp --sandbox ./workspace
Defensive patterns

Strategy: validation

Validate before calling

if (args.includes('--sandbox') && !args.includes('--mcp')) console.warn('--sandbox requires --mcp to have any effect');

Prevention

When it happens

Trigger: CLI invoked like `repomix --sandbox` (boolean or with a dir) but without `--mcp`, making `sandboxed && !options.mcp` true at src/cli/cliRun.ts:370.

Common situations: 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.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/34d986678c7015be. Report an issue: GitHub.