{"record":{"id":"6e5a15b011d3132f","repo":"different-ai/openwork","slug":"docker-ps-a-failed-status-result-status","errorCode":null,"errorMessage":"docker ps -a failed (status ${result.status})","messagePattern":"docker ps -a failed \\(status (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"apps/desktop/electron/runtime.mjs","lineNumber":1702,"sourceCode":"          stderr: result.stderr ?? \"\",\n        };\n      } catch (error) {\n        errors.push(error instanceof Error ? error.message : String(error));\n      }\n    }\n\n    throw new Error(\n      `Failed to run docker: ${errors.join(\"; \")} (Set OPENWORK_DOCKER_BIN to your docker binary if needed)`,\n    );\n  }\n\n  const legacyOpenworkContainerPrefix = `${[\"openwork\", \"orchestrator\"].join(\"-\")}-`;\n\n  async function listOpenworkManagedContainers() {\n    const result = runDockerCommandDetailed([\"ps\", \"-a\", \"--format\", \"{{.Names}}\"], 8000);\n    if (result.status !== 0) {\n      const combined = `${result.stdout.trim()}\\n${result.stderr.trim()}`.trim();\n      throw new Error(combined || `docker ps -a failed (status ${result.status})`);\n    }\n    return result.stdout\n      .split(/\\r?\\n/)\n      .map((line) => line.trim())\n      .filter((name) => name && (name.startsWith(legacyOpenworkContainerPrefix) || name.startsWith(\"openwork-dev-\") || name.startsWith(\"openwrk-\")))\n      .sort();\n  }\n\n  async function runShellCommand(program, args, options = {}) {\n    const result = spawnSync(program, args, {\n      encoding: \"utf8\",\n      cwd: options.cwd,\n      env: options.env,\n      shell: false,\n      windowsHide: true,\n      timeout: options.timeoutMs,\n    });\n    return {","sourceCodeStart":1684,"sourceCodeEnd":1720,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/desktop/electron/runtime.mjs#L1684-L1720","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Start Docker Desktop / the Docker daemon (`systemctl start docker`) and verify with `docker ps -a`.","Confirm `docker` is on PATH (`which docker`); install Docker CLI if missing.","Fix permissions: add your user to the `docker` group or run the app with a user that can access /var/run/docker.sock.","Check that stderr in the thrown error (when non-empty) for the underlying daemon message and address it directly."],"exampleFix":"// before\nconst result = runDockerCommandDetailed([\"ps\", \"-a\", \"--format\", \"{{.Names}}\"], 8000);\nif (result.status !== 0) {\n  throw new Error(combined || `docker ps -a failed (status ${result.status})`);\n}\n// after\nif (!isDockerDaemonReachable()) {\n  throw new Error(\"Docker daemon is not running. Start Docker Desktop and retry.\");\n}\nconst result = runDockerCommandDetailed([\"ps\", \"-a\", \"--format\", \"{{.Names}}\"], 8000);","handlingStrategy":"try-catch","validationCode":"import { execFileSync } from \"node:child_process\";\nfunction isDockerReady() {\n  try { execFileSync(\"docker\", [\"info\", \"--format\", \"ok\"], { timeout: 5000 }); return true; }\n  catch { return false; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const containers = await listOpenworkManagedContainers();\n} catch (err) {\n  const detail = String(err.message);\n  if (/Cannot connect to the Docker daemon|docker: not found|permission denied/i.test(detail)) {\n    promptUserToStartDocker();\n  } else {\n    throw err;\n  }\n}","preventionTips":["Check `docker info` health before any docker-dependent feature.","On Linux, ensure the app user is in the docker group or the daemon socket is accessible.","Retry once with a short delay after Docker Desktop launch — the daemon takes time to come up.","Surface a 'Docker is required' precondition in onboarding rather than failing mid-operation."],"tags":["docker","process","environment"],"backgroundTag":"docker-daemon-unreachable","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}