{"record":{"id":"256f1a7a5efd6f90","repo":"paperclipai/paperclip","slug":"pinned-opencode-materialization-requires-linux-x64","errorCode":null,"errorMessage":"Pinned OpenCode materialization requires linux/x64, received ${platform}/${architecture}","messagePattern":"Pinned OpenCode materialization requires linux/x64, received (.+?)/(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/scripts/materialize-opencode-binary.mjs","lineNumber":43,"sourceCode":"}\n\nfunction assertPackage(packageRoot, expectedName) {\n  const packageJson = readPackage(join(packageRoot, \"package.json\"));\n  if (\n    packageJson.name !== expectedName ||\n    packageJson.version !== OPENCODE_VERSION\n  ) {\n    throw new Error(\n      `Expected ${expectedName}@${OPENCODE_VERSION}, received ${String(packageJson.name)}@${String(packageJson.version)}`,\n    );\n  }\n}\n\nexport function materializePinnedOpenCodeBinary(options = {}) {\n  const platform = options.platform ?? process.platform;\n  const architecture = options.architecture ?? process.arch;\n  if (platform !== \"linux\" || architecture !== \"x64\") {\n    throw new Error(\n      `Pinned OpenCode materialization requires linux/x64, received ${platform}/${architecture}`,\n    );\n  }\n\n  const packageRoot = realpathSync(\n    options.packageRoot ??\n      resolve(import.meta.dirname, \"../node_modules/opencode-ai\"),\n  );\n  const dependencyRoot = dirname(packageRoot);\n  const baselineRoot = realpathSync(join(dependencyRoot, BASELINE_PACKAGE));\n  assertPackage(packageRoot, \"opencode-ai\");\n  assertPackage(baselineRoot, BASELINE_PACKAGE);\n\n  const source = join(baselineRoot, \"bin\", \"opencode\");\n  const target = join(packageRoot, \"bin\", \"opencode.exe\");\n  if (!lstatSync(source).isFile()) {\n    throw new Error(\"Pinned OpenCode source executable is not a regular file\");\n  }","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/scripts/materialize-opencode-binary.mjs#L25-L61","documentation":"materializePinnedOpenCodeBinary only supports hard-linking the pinned OpenCode binary on linux/x64. On any other platform or architecture it throws immediately because the materialization path is only validated there.","triggerScenarios":"Calling materializePinnedOpenCodeBinary on macOS, Windows, arm64 Linux, or passing explicit options.platform/options.architecture values other than linux/x64.","commonSituations":"A developer runs the script on a MacBook; CI runs on an arm64 runner; a test passes fake platform/architecture options.","solutions":["Run the materialization on a linux/x64 machine (native host, x86_64 container, or linux/x64 CI runner).","If passing options.platform/options.architecture for testing, only use { platform: 'linux', architecture: 'x64' } with mocked fs, not in real materialization.","For arm64 support, extend the script with a validated baseline for that platform rather than removing the guard.","Condition the call in setup scripts when platform is not linux/x64."],"exampleFix":"// before\nawait materializePinnedOpenCodeBinary(); // run anywhere\n// after\nif (process.platform === 'linux' && process.arch === 'x64') {\n  await materializePinnedOpenCodeBinary();\n}","handlingStrategy":"fallback","validationCode":"if (process.platform !== 'linux' || process.arch !== 'x64') {\n  console.warn('Skipping pinned OpenCode materialization: requires linux/x64');\n}","typeGuard":"function supportsPinnedOpenCode(platform = process.platform, arch = process.arch) {\n  return platform === 'linux' && arch === 'x64';\n}","tryCatchPattern":"try {\n  materializePinnedOpenCodeBinary();\n} catch (err) {\n  if (/requires linux\\/x64/.test(err.message)) {\n    console.warn('Materialization skipped on this platform');\n  } else throw err;\n}","preventionTips":["Gate the call behind a platform/arch check in setup scripts.","Run cross-platform builds inside an x86_64 Linux container.","Document the linux/x64 requirement in the script's help text.","Only pass fake platform/arch options in unit tests with mocked fs."],"tags":["platform","unsupported-platform","build"],"backgroundTag":"unsupported-platform","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}