{"record":{"id":"7b003c207807c55d","repo":"can1357/oh-my-pi","slug":"source-mode-container-arch-arch-r-mounted-de","errorCode":null,"errorMessage":"source mode: container arch {arch!r} != mounted deps tree arch ({self._source_arch}); use --binary for emulated-arch tasks","messagePattern":"source mode: container arch (.+?) != mounted deps tree arch \\((.+?)\\); use --binary for emulated-arch tasks","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"packages/metaharness/agent/omp_local.py","lineNumber":348,"sourceCode":"\n    async def _install_source(self, environment: BaseEnvironment) -> str:\n        \"\"\"Verify the read-only repo + linux deps mounts and run omp from TS source.\n\n        The runner mounts the repo at `self._source_dir`, shadows every host\n        `node_modules` with a linux tree, and mounts a linux `bun` binary — so\n        setup needs zero outbound network and no rebuild for TS changes.\n        \"\"\"\n        arch = (\n            await self.exec_as_agent(environment, command=\"uname -m\")\n        ).stdout.strip()\n        norm = {\n            \"aarch64\": \"arm64\",\n            \"arm64\": \"arm64\",\n            \"x86_64\": \"x64\",\n            \"amd64\": \"x64\",\n        }.get(arch)\n        if self._source_arch and norm != self._source_arch:\n            raise RuntimeError(\n                f\"source mode: container arch {arch!r} != mounted deps tree arch \"\n                f\"({self._source_arch}); use --binary for emulated-arch tasks\"\n            )\n        self._bun = self._source_bun\n        cli = f\"{self._source_dir}/packages/coding-agent/src/cli.ts\"\n        q = shlex.quote\n        await self.exec_as_agent(\n            environment,\n            command=(\n                \"set -e; \"\n                f\"test -x {q(self._source_bun)} || {{ echo 'omp source mode: bun mount missing' >&2; exit 5; }}; \"\n                f\"test -f {q(cli)} || {{ echo 'omp source mode: repo mount missing' >&2; exit 5; }}; \"\n                f\"test -d {q(self._source_dir + '/node_modules/@oh-my-pi')} || \"\n                \"{ echo 'omp source mode: linux deps mount missing' >&2; exit 5; }; \"\n                f\"{q(self._source_bun)} --version\"\n            ),\n        )\n        return cli","sourceCodeStart":330,"sourceCodeEnd":366,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/agent/omp_local.py#L330-L366","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Switch the benchmark to binary install mode (e.g. --binary / OMP_BENCH_INSTALL=binary) and supply the binary matching the container arch.","Run the container in the same architecture as the mounted deps tree (remove --platform emulation).","Rebuild the source deps tree inside the container arch (re-run bun install on the container arch) so self._source_arch matches.","Ensure the environment exposes the correct arch detection so the comparison reflects reality."],"exampleFix":"# before (emulated arch container with host-built deps)\nOMP_BENCH_INSTALL=source docker run --platform linux/amd64 ...\n# after\nOMP_BENCH_INSTALL=binary OMP_BENCH_BINARY_X64=/path/to/omp-x64 ...","handlingStrategy":"validation","validationCode":"import platform\narch = platform.machine()\nnorm = {\"aarch64\": \"arm64\", \"arm64\": \"arm64\", \"x86_64\": \"x64\", \"amd64\": \"x64\"}.get(arch)\nif source_arch and norm != source_arch:\n    os.environ[\"OMP_BENCH_INSTALL\"] = \"binary\"  # switch before running","typeGuard":null,"tryCatchPattern":"try:\n    await harness.install(env)\nexcept RuntimeError as e:\n    if \"container arch\" in str(e) and \"mounted deps tree arch\" in str(e):\n        harness = make_harness(install=\"binary\", binary_x64=..., binary_arm64=...)\n        await harness.install(env)\n    else:\n        raise","preventionTips":["Match container --platform to the host arch that built the deps tree.","Avoid QEMU cross-arch emulation for source-mode tasks.","Detect arch (uname -m) before choosing install mode.","Rebuild node_modules on the container arch if you must use source mode."],"tags":["architecture","containerization","environment-mismatch"],"backgroundTag":"arch-mismatch","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}