google-gemini/gemini-cli · error · FatalSandboxError

LXC container '${containerName}' is not running (current sta

Error message

LXC container '${containerName}' is not running (current status: ${container.status}). Start it with: lxc start ${containerName}

What it means

Thrown when the named LXC container exists but its status is not 'running' (case-insensitive comparison). A stopped/frozen container cannot accept the workspace mount or execute commands, so the user is told to start it.

Source

Thrown at packages/cli/src/utils/sandbox.ts:961

        )
        .map((item) => ({
          name: String(item['name']),
          status: String(item['status']),
        }));
    }
  } catch {
    containers = [];
  }

  const container = containers.find((c) => c.name === containerName);
  if (!container) {
    throw new FatalSandboxError(
      `LXC container '${containerName}' not found. ` +
        `Create one with: lxc launch ubuntu:24.04 ${containerName}`,
    );
  }
  if (container.status.toLowerCase() !== 'running') {
    throw new FatalSandboxError(
      `LXC container '${containerName}' is not running (current status: ${container.status}). ` +
        `Start it with: lxc start ${containerName}`,
    );
  }

  const devicesToRemove: string[] = [];
  const removeDevices = () => {
    for (const deviceName of devicesToRemove) {
      try {
        spawnSync(
          'lxc',
          ['config', 'device', 'remove', containerName, deviceName],
          { timeout: 1000, killSignal: 'SIGKILL', stdio: 'ignore' },
        );
      } catch {
        // Best-effort cleanup; ignore errors on exit.
      }
    }

View on GitHub (pinned to 5024443c72)

Solutions

  1. Start the container: `lxc start <containerName>`.
  2. If frozen, unfreeze: `lxc unpause <containerName>`.
  3. Configure the container to auto-start: `lxc config device add <containerName> ... ` or set boot.autostart=true.

Example fix

// before: container stopped
// lxc list  -> gemini-sandbox | STOPPED

// after
// lxc start gemini-sandbox
Defensive patterns

Strategy: validation

Validate before calling

const { execSync } = require('child_process');
function ensureContainerRunning(name) {
  const out = execSync(`lxc list ${name} --format=json`, {encoding:'utf8'});
  const c = JSON.parse(out).find(x => x.name === name);
  if (c && c.status.toLowerCase() !== 'running') {
    execSync(`lxc start ${name}`, {stdio:'inherit'});
  }
}

Prevention

When it happens

Trigger: container.status.toLowerCase() !== 'running' — container is in 'Stopped', 'Frozen', or any non-running state. Checked after the existence check at sandbox.ts:955.

Common situations: Container was stopped after a reboot or by an autoscaler. Container is in 'Frozen' state. Manual stop during a previous session. LXD auto-start not configured so containers stay stopped after host restart.

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/5545887aeefb092d. Report an issue: GitHub.