{"record":{"id":"47cb7ee92b70cd04","repo":"can1357/oh-my-pi","slug":"no-omp-binary-available-for-guest-architecture-v","errorCode":null,"errorMessage":"No omp binary available for guest architecture ${vm.arch}","messagePattern":"No omp binary available for guest architecture (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/agent.ts","lineNumber":91,"sourceCode":"\t\tawait run([\"bun\", \"scripts/ci-release-build-binaries.ts\", \"--targets\", targets], REPO_ROOT);\n\t\tfor (const arch of missing) {\n\t\t\tconst source = path.join(CODING_AGENT_DIR, \"binaries\", `omp-linux-${arch}`);\n\t\t\tconst destination = cached[arch]!;\n\t\t\tif (!(await Bun.file(source).exists())) throw new Error(`Binary build did not produce ${source}`);\n\t\t\tawait Bun.write(destination, Bun.file(source));\n\t\t\tawait fs.chmod(destination, 0o755);\n\t\t}\n\t}\n\n\tconst binaries: AgentBinaries = { version: manifest.version };\n\tfor (const arch of arches) binaries[arch] = cached[arch];\n\treturn binaries;\n}\n\n/** Install omp and gateway-only configuration into one running trial microVM. */\nexport async function installAgent(vm: TrialVm, binaries: AgentBinaries, gateway: GatewayConfig): Promise<string> {\n\tconst binary = binaries[vm.arch];\n\tif (!binary) throw new Error(`No omp binary available for guest architecture ${vm.arch}`);\n\n\tconst entrypoint = \"/opt/omp/omp\";\n\tconst mkdir = await vm.exec(\"mkdir -p /opt/omp\");\n\tif (mkdir.exitCode !== 0) throw new Error(`Could not create /opt/omp: ${mkdir.stderr.trim()}`);\n\tawait vm.copyTo(binary, entrypoint);\n\tconst chmod = await vm.exec(`chmod 755 ${shellQuote(entrypoint)}`);\n\tif (chmod.exitCode !== 0) throw new Error(`Could not make omp executable: ${chmod.stderr.trim()}`);\n\tconst warmup = await vm.exec(`${shellQuote(entrypoint)} --version`);\n\tif (warmup.exitCode !== 0) throw new Error(`omp --version failed: ${warmup.stderr.trim()}`);\n\n\tconst providers = [...new Set(gateway.providers)];\n\tconst modelLines = [\"# Generated by metaharness — auth via host pm2 gateway.\", \"providers:\"];\n\tfor (const provider of providers) {\n\t\tmodelLines.push(`  ${provider}:`);\n\t\tmodelLines.push(`    baseUrl: ${gateway.url}`);\n\t\tmodelLines.push(\"    auth: oauth\");\n\t\tmodelLines.push(\"    transport: pi-native\");\n\t\tmodelLines.push(`    apiKey: ${gateway.token}`);","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/agent.ts#L73-L109","documentation":"installAgent installs the omp binary into a running trial microVM and throws this error when the AgentBinaries map has no prebuilt binary for the VM's guest architecture. Binaries are only prepared for the arches requested at prepare time, so a VM on an unprepared arch cannot be provisioned.","triggerScenarios":"Calling `installAgent(vm, binaries, gateway)` with a TrialVm whose `vm.arch` was not included in the `arches` passed to prepareAgentBinaries (so `binaries[vm.arch]` is undefined).","commonSituations":"Spawning arm64 microVMs while only x64 binaries were prepared (or vice versa); a config change added new guest arches without updating prepareAgentBinaries call; arch mismatch between host defaults and VM template.","solutions":["Include the VM's arch in the `arches` option when calling prepareAgentBinaries","Prepare binaries for all arches your VM fleet uses: `arches: [\"x64\", \"arm64\"]`","Constrain VM creation to arches that have binaries, checking `binaries[arch]` before launching the VM","If caching is used, make sure the cache was populated for that arch/version"],"exampleFix":"// before\nconst binaries = await prepareAgentBinaries({ arches: [\"x64\"], cacheDir, rebuild: false });\nawait installAgent(arm64Vm, binaries, gateway); // throws\n// after\nconst arches = [...new Set(vms.map(vm => vm.arch))];\nconst binaries = await prepareAgentBinaries({ arches, cacheDir, rebuild: false });","handlingStrategy":"fallback","validationCode":"function binaryAvailable(binaries: AgentBinaries, arch: GuestArch): boolean {\n  return typeof binaries[arch] === \"string\" && binaries[arch].length > 0;\n}","typeGuard":"function hasBinary(b: AgentBinaries, arch: GuestArch): boolean {\n  return b[arch] !== undefined;\n}","tryCatchPattern":"try {\n  await installAgent(vm, binaries, gateway);\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith(\"No omp binary available\")) {\n    const prepared = await prepareAgentBinaries({ arches: [vm.arch], cacheDir, rebuild: false });\n    await installAgent(vm, prepared, gateway);\n  } else throw err;\n}","preventionTips":["Prepare binaries for every guest arch your VM fleet can use","Check binaries[vm.arch] before launching a VM of that arch","Derive the arches list from the VM configuration, not a hardcoded subset","Validate VM templates and binary arches match during setup"],"tags":["configuration","architecture","provisioning"],"backgroundTag":"missing-binary-for-arch","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}