{"record":{"id":"f99c2658e033d9f8","repo":"stablyai/orca","slug":"missing-built-relay-artifacts-for-platform-run","errorCode":null,"errorMessage":"Missing built relay artifacts for ${platform}; run pnpm run build:relay first","messagePattern":"Missing built relay artifacts for (.+?); run pnpm run build:relay first","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/relay-watcher-fault-harness.mjs","lineNumber":241,"sourceCode":"      return pid\n    },\n    previousPid ? 'replacement watcher child pid' : 'initial watcher child pid',\n    stderr\n  )\n}\n\nfunction includesWatchPath(params, targetPath) {\n  return Array.isArray(params.events)\n    ? params.events.some((event) => event.absolutePath === targetPath)\n    : false\n}\n\nasync function main() {\n  const platform = `${process.platform}-${process.arch}`\n  const relayEntry = resolve('out', 'relay', platform, 'relay.js')\n  const watcherEntry = resolve('out', 'relay', platform, 'relay-watcher.js')\n  if (!existsSync(relayEntry) || !existsSync(watcherEntry)) {\n    throw new Error(`Missing built relay artifacts for ${platform}; run pnpm run build:relay first`)\n  }\n\n  let tempRoot\n  let daemon\n  let daemonStreams\n  let relay\n  try {\n    tempRoot = await mkdtemp(join(tmpdir(), 'orca-relay-watcher-fault-'))\n    const watchRoot = await realpath(tempRoot)\n    const pidFile = join(tempRoot, 'watcher.pid')\n    const credentialFile = join(tempRoot, 'endpoint.credential')\n    const protocol = await loadProtocol(tempRoot)\n    const socketPath =\n      process.platform === 'win32'\n        ? `\\\\\\\\.\\\\pipe\\\\orca-relay-watcher-fault-${process.pid}-${Date.now()}`\n        : join(tempRoot, 'relay.sock')\n    await writeEndpointCredential(credentialFile)\n","sourceCodeStart":223,"sourceCodeEnd":259,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/relay-watcher-fault-harness.mjs#L223-L259","documentation":"Thrown by the relay watcher fault harness when the platform-specific relay build artifacts (out/relay/<platform-arch>/relay.js and relay-watcher.js) are missing. The harness spawns these built JS entries to inject watcher faults, so they must exist before launch.","triggerScenarios":"Running the fault harness before building the relay, or on a fresh checkout / after `git clean` without rebuilding. The platform string is computed as `${process.platform}-${process.arch}`.","commonSituations":"A CI step runs the harness out of order, or a developer clones the repo and runs the harness directly. Cross-compiling for a different arch also produces the mismatch since the path is host-derived.","solutions":["Run `pnpm run build:relay` to produce the artifacts under out/relay/<platform-arch>/.","Verify the expected path matches your current platform: out/relay/<process.platform>-<process.arch>/relay.js."],"exampleFix":"// before\nnode config/scripts/relay-watcher-fault-harness.mjs\n// after\npnpm run build:relay && node config/scripts/relay-watcher-fault-harness.mjs","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\nconst platform = `${process.platform}-${process.arch}`\nconst relayEntry = resolve('out', 'relay', platform, 'relay.js')\nconst watcherEntry = resolve('out', 'relay', platform, 'relay-watcher.js')\nif (!existsSync(relayEntry) || !existsSync(watcherEntry)) {\n  throw new Error(`Build the relay first: pnpm run build:relay (missing ${platform} artifacts)`)\n}","typeGuard":"function relayArtifactsExist(platform) {\n  return existsSync(resolve('out', 'relay', platform, 'relay.js')) &&\n    existsSync(resolve('out', 'relay', platform, 'relay-watcher.js'))\n}","tryCatchPattern":null,"preventionTips":["Chain the build and the harness in CI: `pnpm run build:relay && node .../relay-watcher-fault-harness.mjs`.","Add a preflight existsSync check in a shared harness bootstrap to give a clearer error before spawning."],"tags":["build","relay","missing-artifacts","fault-harness"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}