different-ai/openwork · error

docker ps -a failed (status )

Error message

docker ps -a failed (status ${result.status})

What it means

listOpenworkManagedContainers() in the Electron runtime shells out to `docker ps -a --format {{.Names}}` to enumerate OpenWork-managed containers. When the docker command exits with a nonzero status, it throws an Error carrying the combined stdout/stderr, or this generic message with the exit status if docker produced no output. It signals that container inventory could not be read from the local Docker daemon.

Solutions

  1. Start Docker Desktop / the Docker daemon (`systemctl start docker`) and verify with `docker ps -a`.
  2. Confirm `docker` is on PATH (`which docker`); install Docker CLI if missing.
  3. Fix permissions: add your user to the `docker` group or run the app with a user that can access /var/run/docker.sock.
  4. Check that stderr in the thrown error (when non-empty) for the underlying daemon message and address it directly.

Example fix

// before
const result = runDockerCommandDetailed(["ps", "-a", "--format", "{{.Names}}"], 8000);
if (result.status !== 0) {
  throw new Error(combined || `docker ps -a failed (status ${result.status})`);
}
// after
if (!isDockerDaemonReachable()) {
  throw new Error("Docker daemon is not running. Start Docker Desktop and retry.");
}
const result = runDockerCommandDetailed(["ps", "-a", "--format", "{{.Names}}"], 8000);
Defensive patterns

Strategy: try-catch

Validate before calling

import { execFileSync } from "node:child_process";
function isDockerReady() {
  try { execFileSync("docker", ["info", "--format", "ok"], { timeout: 5000 }); return true; }
  catch { return false; }
}

Try / catch

try {
  const containers = await listOpenworkManagedContainers();
} catch (err) {
  const detail = String(err.message);
  if (/Cannot connect to the Docker daemon|docker: not found|permission denied/i.test(detail)) {
    promptUserToStartDocker();
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: runDockerCommandDetailed(["ps","-a","--format","{{.Names}}"], 8000) returns status !== 0 — e.g. Docker daemon not running, docker CLI missing from PATH, daemon socket permission denied, or the 8s timeout elapsing — and both stdout and stderr are empty.

Common situations: Docker Desktop is not started; the user isn't in the `docker` group on Linux; docker was uninstalled or only podman is present; Docker Desktop is still booting so the CLI is present but the daemon is unreachable and prints nothing.

Related errors


AI-assisted analysis of different-ai/openwork@2b7df46e8a (2026-09-01). Data as JSON: /api/errors/6e5a15b011d3132f. Report an issue: GitHub.

Appendix: source

Thrown at apps/desktop/electron/runtime.mjs:1702

          stderr: result.stderr ?? "",
        };
      } catch (error) {
        errors.push(error instanceof Error ? error.message : String(error));
      }
    }

    throw new Error(
      `Failed to run docker: ${errors.join("; ")} (Set OPENWORK_DOCKER_BIN to your docker binary if needed)`,
    );
  }

  const legacyOpenworkContainerPrefix = `${["openwork", "orchestrator"].join("-")}-`;

  async function listOpenworkManagedContainers() {
    const result = runDockerCommandDetailed(["ps", "-a", "--format", "{{.Names}}"], 8000);
    if (result.status !== 0) {
      const combined = `${result.stdout.trim()}\n${result.stderr.trim()}`.trim();
      throw new Error(combined || `docker ps -a failed (status ${result.status})`);
    }
    return result.stdout
      .split(/\r?\n/)
      .map((line) => line.trim())
      .filter((name) => name && (name.startsWith(legacyOpenworkContainerPrefix) || name.startsWith("openwork-dev-") || name.startsWith("openwrk-")))
      .sort();
  }

  async function runShellCommand(program, args, options = {}) {
    const result = spawnSync(program, args, {
      encoding: "utf8",
      cwd: options.cwd,
      env: options.env,
      shell: false,
      windowsHide: true,
      timeout: options.timeoutMs,
    });
    return {

View on GitHub (pinned to 2b7df46e8a)