coleam00/Archon · error

Failed to inspect container '${nameOrId}': ${detail}

Error message

Failed to inspect container '${nameOrId}': ${detail}

What it means

presence() runs `docker inspect -f {{.State.Running}}` and distinguishes 'running'/'stopped'/'missing'. A 'no such object/container' error is treated as 'missing', but any other docker inspect failure is unexpected and rethrown wrapped in this message.

Source

Thrown at packages/isolation/src/backends/container.ts:499

    overlayMode: OverlayMode
  ): PreparedEnv {
    return { cwd, execContext: { kind: 'container', containerId }, envId, overlayMode };
  }

  /**
   * Container presence as three outcomes: `running`, `stopped` (exists but not
   * running), or `missing` (no such container). Distinct from {@link containerState}
   * which folds "missing" and "inspect blip" into `unknown` — resume MUST tell
   * "gone" (→ recreate over the volume) apart from "stopped" (→ start).
   */
  private async describeContainer(nameOrId: string): Promise<'running' | 'stopped' | 'missing'> {
    try {
      const { stdout } = await this.docker(['inspect', '-f', '{{.State.Running}}', nameOrId]);
      return stdout.trim() === 'true' ? 'running' : 'stopped';
    } catch (err) {
      const detail = extractDockerError(err);
      if (/no such (object|container)/i.test(detail)) return 'missing';
      throw new Error(`Failed to inspect container '${nameOrId}': ${detail}`);
    }
  }

  private async getContainerId(nameOrId: string): Promise<string> {
    const { stdout } = await this.docker(['inspect', '-f', '{{.Id}}', nameOrId]);
    return stdout.trim();
  }

  private async volumeExists(volume: string): Promise<boolean> {
    try {
      await this.docker(['volume', 'inspect', volume]);
      return true;
    } catch (err) {
      const detail = extractDockerError(err);
      if (/no such volume/i.test(detail)) return false;
      throw new Error(`Failed to inspect volume '${volume}': ${detail}`);
    }
  }

View on GitHub (pinned to 0773b97458)

Solutions

  1. Run `docker inspect <name>` manually to see the raw error
  2. Check Docker daemon health (`docker info`) and DOCKER_HOST/DOCKER_CONTEXT settings
  3. Verify socket permissions (add user to docker group or adjust socket access)
  4. Retry once transient errors are resolved
Defensive patterns

Strategy: try-catch

Validate before calling

const { execSync } = require('child_process');
try { execSync('docker info', { stdio: 'ignore' }); } catch { throw new Error('Docker daemon not reachable'); }

Try / catch

try {
  const state = await backend.presence(nameOrId);
} catch (err) {
  if (String(err).startsWith('Failed to inspect container')) {
    // daemon-level problem, not a missing container — log and stop
  }
  throw err;
}

Prevention

When it happens

Trigger: `docker inspect` fails with an error other than 'no such object' — e.g. daemon unreachable mid-call, permission denied on the socket, malformed name string, or daemon timeout.

Common situations: Docker daemon restarted or crashed between calls; user not in the docker group; stale DOCKER_HOST/DOCKER_CONTEXT pointing at an unreachable daemon; a container name with invalid characters from config.

Related errors


AI-assisted analysis of coleam00/Archon@0773b97458 (2026-09-01). Data as JSON: /api/errors/9d65d81d539dacb7. Report an issue: GitHub.