{"record":{"id":"ee9d51985ebe6dd2","repo":"can1357/oh-my-pi","slug":"omp-version-failed-warmup-stderr-trim","errorCode":null,"errorMessage":"omp --version failed: ${warmup.stderr.trim()}","messagePattern":"omp --version failed: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/metaharness/src/tb/agent.ts","lineNumber":100,"sourceCode":"\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}`);\n\t}\n\tconst modelsYaml = `${modelLines.join(\"\\n\")}\\n`;\n\tconst configYaml = `providers:\n  openrouterVariant: ${gateway.openrouterVariant}\nmodelRoles:\n  vision: openrouter/qwen/qwen3.7-flash\nedit:\n  mode: replace\nweb_search:","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/src/tb/agent.ts#L82-L118","documentation":"As a post-install warmup, installAgent executes `/opt/omp/omp --version` inside the VM. Non-zero exit means the freshly installed binary does not run, so this error is thrown with the binary's stderr.","triggerScenarios":"`omp --version` exits non-zero — the binary was built for the wrong guest architecture (vm.arch mismatch), missing dynamic libraries, corrupt/truncated copy, or the binary crashes at startup.","commonSituations":"Cross-arch VM (arm64 guest, x86_64 binary) with no binfmt/qemu emulation; glibc/musl mismatch between build host and guest; interrupted copyTo leaving a truncated file; binary requires a newer kernel than the guest runs.","solutions":["Read stderr: 'Exec format error' = arch mismatch; 'not found' for a shared library = link mismatch","Confirm binaries[vm.arch] matches the guest architecture","Re-copy the binary and re-run `omp --version` manually in the VM to reproduce","Rebuild omp statically or for the guest's libc (musl vs glibc)","Check the guest kernel version meets the binary's minimum"],"exampleFix":"// before: x86_64 binary copied into arm64 guest -> 'Exec format error'\nconst binary = binaries[vm.arch];\nif (!binary) throw new Error(`No omp binary available for guest architecture ${vm.arch}`);\n// after: fail fast with an explicit arch check before warmup\nconst arch = await vm.exec(\"uname -m\");\nif (!binary || !binary.path.includes(arch.stdout.trim())) {\n\tthrow new Error(`omp binary does not match guest arch ${arch.stdout.trim()}`);\n}","handlingStrategy":"try-catch","validationCode":"const arch = (await vm.exec(\"uname -m\")).stdout.trim();\nif (!binaries[arch]) throw new Error(`no omp binary for guest arch ${arch}`);","typeGuard":null,"tryCatchPattern":"try {\n  await installAgent(vm, binaries, gateway);\n} catch (err) {\n  if (String(err.message).includes(\"omp --version failed\")) {\n    const dbg = await vm.exec(\"file /opt/omp/omp; ldd /opt/omp/omp || true\");\n    console.error(dbg.stdout, err);\n  }\n  throw err;\n}","preventionTips":["Build static or musl binaries for guest compatibility","Keep binaries map keyed by exact `uname -m` output","Re-verify binary integrity (checksum) after copyTo"],"tags":["vm","binary","architecture","warmup"],"backgroundTag":"exec-format-error","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}