{"record":{"id":"5545887aeefb092d","repo":"google-gemini/gemini-cli","slug":"lxc-container-containername-is-not-running-c","errorCode":null,"errorMessage":"LXC container '${containerName}' is not running (current status: ${container.status}). Start it with: lxc start ${containerName}","messagePattern":"LXC container '(.+?)' is not running \\(current status: (.+?)\\)\\. Start it with: lxc start (.+?)","errorType":"exception","errorClass":"FatalSandboxError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/utils/sandbox.ts","lineNumber":961,"sourceCode":"        )\n        .map((item) => ({\n          name: String(item['name']),\n          status: String(item['status']),\n        }));\n    }\n  } catch {\n    containers = [];\n  }\n\n  const container = containers.find((c) => c.name === containerName);\n  if (!container) {\n    throw new FatalSandboxError(\n      `LXC container '${containerName}' not found. ` +\n        `Create one with: lxc launch ubuntu:24.04 ${containerName}`,\n    );\n  }\n  if (container.status.toLowerCase() !== 'running') {\n    throw new FatalSandboxError(\n      `LXC container '${containerName}' is not running (current status: ${container.status}). ` +\n        `Start it with: lxc start ${containerName}`,\n    );\n  }\n\n  const devicesToRemove: string[] = [];\n  const removeDevices = () => {\n    for (const deviceName of devicesToRemove) {\n      try {\n        spawnSync(\n          'lxc',\n          ['config', 'device', 'remove', containerName, deviceName],\n          { timeout: 1000, killSignal: 'SIGKILL', stdio: 'ignore' },\n        );\n      } catch {\n        // Best-effort cleanup; ignore errors on exit.\n      }\n    }","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/utils/sandbox.ts#L943-L979","documentation":"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.","triggerScenarios":"container.status.toLowerCase() !== 'running' — container is in 'Stopped', 'Frozen', or any non-running state. Checked after the existence check at sandbox.ts:955.","commonSituations":"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.","solutions":["Start the container: `lxc start <containerName>`.","If frozen, unfreeze: `lxc unpause <containerName>`.","Configure the container to auto-start: `lxc config device add <containerName> ... ` or set boot.autostart=true."],"exampleFix":"// before: container stopped\n// lxc list  -> gemini-sandbox | STOPPED\n\n// after\n// lxc start gemini-sandbox","handlingStrategy":"validation","validationCode":"const { execSync } = require('child_process');\nfunction ensureContainerRunning(name) {\n  const out = execSync(`lxc list ${name} --format=json`, {encoding:'utf8'});\n  const c = JSON.parse(out).find(x => x.name === name);\n  if (c && c.status.toLowerCase() !== 'running') {\n    execSync(`lxc start ${name}`, {stdio:'inherit'});\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set boot.autostart=true on sandbox containers so they survive host reboots.","Run a preflight status check before invoking the sandbox."],"tags":["sandbox","lxc","lxd","container","lifecycle"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}