can1357/oh-my-pi · error · RuntimeError

source mode: container arch {arch!r} != mounted deps tree ar

Error message

source mode: container arch {arch!r} != mounted deps tree arch ({self._source_arch}); use --binary for emulated-arch tasks

What it means

In source mode, omp_local mounts a host-built dependency tree (and source bun) into the container and asserts the container CPU architecture matches the arch the mounted deps tree was built for (self._source_arch). A mismatch (e.g. x86_64 deps in an arm64 container) would produce broken native modules, so install() raises this RuntimeError. The suggested remedy is running the task in binary mode with a binary matching the container arch.

Source

Thrown at packages/metaharness/agent/omp_local.py:348

    async def _install_source(self, environment: BaseEnvironment) -> str:
        """Verify the read-only repo + linux deps mounts and run omp from TS source.

        The runner mounts the repo at `self._source_dir`, shadows every host
        `node_modules` with a linux tree, and mounts a linux `bun` binary — so
        setup needs zero outbound network and no rebuild for TS changes.
        """
        arch = (
            await self.exec_as_agent(environment, command="uname -m")
        ).stdout.strip()
        norm = {
            "aarch64": "arm64",
            "arm64": "arm64",
            "x86_64": "x64",
            "amd64": "x64",
        }.get(arch)
        if self._source_arch and norm != self._source_arch:
            raise RuntimeError(
                f"source mode: container arch {arch!r} != mounted deps tree arch "
                f"({self._source_arch}); use --binary for emulated-arch tasks"
            )
        self._bun = self._source_bun
        cli = f"{self._source_dir}/packages/coding-agent/src/cli.ts"
        q = shlex.quote
        await self.exec_as_agent(
            environment,
            command=(
                "set -e; "
                f"test -x {q(self._source_bun)} || {{ echo 'omp source mode: bun mount missing' >&2; exit 5; }}; "
                f"test -f {q(cli)} || {{ echo 'omp source mode: repo mount missing' >&2; exit 5; }}; "
                f"test -d {q(self._source_dir + '/node_modules/@oh-my-pi')} || "
                "{ echo 'omp source mode: linux deps mount missing' >&2; exit 5; }; "
                f"{q(self._source_bun)} --version"
            ),
        )
        return cli

View on GitHub (pinned to 9690622007)

Solutions

  1. Switch the benchmark to binary install mode (e.g. --binary / OMP_BENCH_INSTALL=binary) and supply the binary matching the container arch.
  2. Run the container in the same architecture as the mounted deps tree (remove --platform emulation).
  3. Rebuild the source deps tree inside the container arch (re-run bun install on the container arch) so self._source_arch matches.
  4. Ensure the environment exposes the correct arch detection so the comparison reflects reality.

Example fix

# before (emulated arch container with host-built deps)
OMP_BENCH_INSTALL=source docker run --platform linux/amd64 ...
# after
OMP_BENCH_INSTALL=binary OMP_BENCH_BINARY_X64=/path/to/omp-x64 ...
Defensive patterns

Strategy: validation

Validate before calling

import platform
arch = platform.machine()
norm = {"aarch64": "arm64", "arm64": "arm64", "x86_64": "x64", "amd64": "x64"}.get(arch)
if source_arch and norm != source_arch:
    os.environ["OMP_BENCH_INSTALL"] = "binary"  # switch before running

Try / catch

try:
    await harness.install(env)
except RuntimeError as e:
    if "container arch" in str(e) and "mounted deps tree arch" in str(e):
        harness = make_harness(install="binary", binary_x64=..., binary_arm64=...)
        await harness.install(env)
    else:
        raise

Prevention

When it happens

Trigger: Running a benchmark task in OMP_BENCH_INSTALL=source mode inside a container whose platform (uname -m) normalizes to a different arch than the one the host source deps tree was built for (self._source_arch), e.g. arm64 host deps with an x86_64 container or emulated cross-arch container.

Common situations: Docker/container emulation (--platform linux/amd64 on an arm64 host or via QEMU); running benchmarks in a different-arch CI runner; reusing a source checkout whose node_modules were built for the host arch.

Related errors


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