{"record":{"id":"c4df465b04a3b893","repo":"can1357/oh-my-pi","slug":"cannot-detect-docker-server-arch-got-a-noth","errorCode":null,"errorMessage":"cannot detect docker server arch (got ${a || \"nothing\"}); is docker running?","messagePattern":"cannot detect docker server arch \\(got (.+?)\\); is docker running\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/runner.ts","lineNumber":1047,"sourceCode":"}\n\n/** Bun version pinned by the repo's `packageManager` field. */\nfunction repoBunVersion(): string {\n\tconst raw = readJson(path.join(REPO_ROOT, \"package.json\"));\n\tif (raw && typeof raw === \"object\") {\n\t\tconst pm = (raw as Record<string, unknown>).packageManager;\n\t\tif (typeof pm === \"string\" && pm.startsWith(\"bun@\")) return pm.slice(\"bun@\".length);\n\t}\n\treturn \"1.4.0\";\n}\n\n/** Native arch of the docker daemon (what non-emulated task containers run as). */\nfunction dockerServerArch(): \"arm64\" | \"x64\" {\n\tconst r = spawnSync(\"docker\", [\"version\", \"--format\", \"{{.Server.Arch}}\"], { encoding: \"utf8\" });\n\tconst a = (r.stdout ?? \"\").trim();\n\tif (a === \"arm64\" || a === \"aarch64\") return \"arm64\";\n\tif (a === \"amd64\" || a === \"x86_64\") return \"x64\";\n\tthrow new Error(`cannot detect docker server arch (got ${a || \"nothing\"}); is docker running?`);\n}\n\n/** Workspace member dirs (repo-relative), expanded from root package.json `workspaces.packages`. */\nfunction workspacePackageDirs(): string[] {\n\tconst raw = readJson(path.join(REPO_ROOT, \"package.json\")) as {\n\t\tworkspaces?: { packages?: string[] };\n\t} | null;\n\tconst dirs = new Set<string>();\n\tfor (const pattern of raw?.workspaces?.packages ?? []) {\n\t\tfor (const match of new Bun.Glob(`${pattern}/package.json`).scanSync({ cwd: REPO_ROOT })) {\n\t\t\tdirs.add(path.dirname(match));\n\t\t}\n\t}\n\treturn [...dirs].sort();\n}\n\n/** Manifest files (repo-relative) that fully determine a `bun install` result. */\nfunction sourceManifestFiles(pkgDirs: string[]): string[] {","sourceCodeStart":1029,"sourceCodeEnd":1065,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/runner.ts#L1029-L1065","documentation":"dockerServerArch() runs `docker version --format {{.Server.Arch}}` and expects the daemon to report arm64/aarch64 or amd64/x86_64. If the output is empty, unparseable, or another arch string, the function throws because it cannot classify the daemon's native architecture for non-emulated task containers. The 'is docker running?' hint reflects that the most common cause is the Docker daemon being down or unreachable.","triggerScenarios":"Calling the metaharness runner while `docker version` returns non-zero (daemon stopped), stdout is empty, or the server arch string is unrecognized (e.g. 'arm', '386', or a placeholder from an old Docker version).","commonSituations":"Docker Desktop not started after reboot; DOCKER_HOST pointing at an unreachable/odd remote daemon; podman or a Docker shim that emits a different arch value; running on an uncommon architecture (e.g. linux/armv7) with no arm64 emulation.","solutions":["Start the Docker daemon (open Docker Desktop, or `sudo systemctl start docker`) and verify with `docker version --format '{{.Server.Arch}}'`","Check DOCKER_HOST / docker context: run `docker context ls` and ensure the active context reaches a healthy daemon","Confirm your Docker version is recent enough to report Server.Arch (`docker version`)","If on an unsupported arch, run tasks on arm64 or x86_64 hardware/emulation"],"exampleFix":"// before (daemon down)\n$ docker version --format '{{.Server.Arch}}'\ncannot connect to the Docker daemon\n// after\n$ open -a Docker   # or: sudo systemctl start docker\n$ docker version --format '{{.Server.Arch}}'\narm64","handlingStrategy":"validation","validationCode":"import { spawnSync } from \"node:child_process\";\nfunction dockerReady(): boolean {\n  const r = spawnSync(\"docker\", [\"version\", \"--format\", \"{{.Server.Arch}}\"], { encoding: \"utf8\" });\n  const arch = (r.stdout ?? \"\").trim();\n  return r.status === 0 && [\"arm64\", \"aarch64\", \"amd64\", \"x86_64\"].includes(arch);\n}\nif (!dockerReady()) throw new Error(\"start Docker first\");","typeGuard":"function isKnownArch(a: string): a is \"arm64\" | \"x64\" {\n  return a === \"arm64\" || a === \"aarch64\" || a === \"amd64\" || a === \"x86_64\";\n}","tryCatchPattern":"try {\n  await runHarness();\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"cannot detect docker server arch\")) {\n    console.error(\"Docker daemon is not reachable; start Docker Desktop / dockerd and retry.\");\n  } else throw err;\n}","preventionTips":["Check `docker ps` as a preflight before launching the harness","Keep Docker Desktop set to auto-start on login","Pin DOCKER_HOST / docker context and validate it in CI setup steps","Run benchmarks only on arm64/x86_64 hosts"],"tags":["docker","environment","architecture"],"backgroundTag":"docker-daemon-unreachable","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}