can1357/oh-my-pi · error · Error

cannot detect docker server arch (got ${a || "nothing"}); is

Error message

cannot detect docker server arch (got ${a || "nothing"}); is docker running?

What it means

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.

Source

Thrown at packages/metaharness/src/runner.ts:1047

}

/** Bun version pinned by the repo's `packageManager` field. */
function repoBunVersion(): string {
	const raw = readJson(path.join(REPO_ROOT, "package.json"));
	if (raw && typeof raw === "object") {
		const pm = (raw as Record<string, unknown>).packageManager;
		if (typeof pm === "string" && pm.startsWith("bun@")) return pm.slice("bun@".length);
	}
	return "1.4.0";
}

/** Native arch of the docker daemon (what non-emulated task containers run as). */
function dockerServerArch(): "arm64" | "x64" {
	const r = spawnSync("docker", ["version", "--format", "{{.Server.Arch}}"], { encoding: "utf8" });
	const a = (r.stdout ?? "").trim();
	if (a === "arm64" || a === "aarch64") return "arm64";
	if (a === "amd64" || a === "x86_64") return "x64";
	throw new Error(`cannot detect docker server arch (got ${a || "nothing"}); is docker running?`);
}

/** Workspace member dirs (repo-relative), expanded from root package.json `workspaces.packages`. */
function workspacePackageDirs(): string[] {
	const raw = readJson(path.join(REPO_ROOT, "package.json")) as {
		workspaces?: { packages?: string[] };
	} | null;
	const dirs = new Set<string>();
	for (const pattern of raw?.workspaces?.packages ?? []) {
		for (const match of new Bun.Glob(`${pattern}/package.json`).scanSync({ cwd: REPO_ROOT })) {
			dirs.add(path.dirname(match));
		}
	}
	return [...dirs].sort();
}

/** Manifest files (repo-relative) that fully determine a `bun install` result. */
function sourceManifestFiles(pkgDirs: string[]): string[] {

View on GitHub (pinned to 9690622007)

Solutions

  1. Start the Docker daemon (open Docker Desktop, or `sudo systemctl start docker`) and verify with `docker version --format '{{.Server.Arch}}'`
  2. Check DOCKER_HOST / docker context: run `docker context ls` and ensure the active context reaches a healthy daemon
  3. Confirm your Docker version is recent enough to report Server.Arch (`docker version`)
  4. If on an unsupported arch, run tasks on arm64 or x86_64 hardware/emulation

Example fix

// before (daemon down)
$ docker version --format '{{.Server.Arch}}'
cannot connect to the Docker daemon
// after
$ open -a Docker   # or: sudo systemctl start docker
$ docker version --format '{{.Server.Arch}}'
arm64
Defensive patterns

Strategy: validation

Validate before calling

import { spawnSync } from "node:child_process";
function dockerReady(): boolean {
  const r = spawnSync("docker", ["version", "--format", "{{.Server.Arch}}"], { encoding: "utf8" });
  const arch = (r.stdout ?? "").trim();
  return r.status === 0 && ["arm64", "aarch64", "amd64", "x86_64"].includes(arch);
}
if (!dockerReady()) throw new Error("start Docker first");

Type guard

function isKnownArch(a: string): a is "arm64" | "x64" {
  return a === "arm64" || a === "aarch64" || a === "amd64" || a === "x86_64";
}

Try / catch

try {
  await runHarness();
} catch (err) {
  if (err instanceof Error && err.message.includes("cannot detect docker server arch")) {
    console.error("Docker daemon is not reachable; start Docker Desktop / dockerd and retry.");
  } else throw err;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/c4df465b04a3b893. Report an issue: GitHub.