{"record":{"id":"1ca487bb3afa8968","repo":"github/copilot-sdk","slug":"packagename-is-missing-required-copilot-cli-run","errorCode":null,"errorMessage":"${packageName} is missing required Copilot CLI runtime files. Reinstall @github/copilot-sdk.","messagePattern":"(.+?) is missing required Copilot CLI runtime files\\. Reinstall @github/copilot-sdk\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/runtimeArtifacts.ts","lineNumber":288,"sourceCode":"            options.cacheRoot,\n            `${version}-${platform}`\n        );\n    }\n\n    const packageName = getRuntimePackageName(platform);\n    const packageRoot = resolvePackageRoot(packageName, options.packageSearchPaths);\n    if (!packageRoot) {\n        throw new Error(\n            `Could not resolve ${packageName}. Reinstall @github/copilot-sdk so its platform package is installed.`\n        );\n    }\n    const wrapperName = platform.startsWith(\"win32\") ? \"copilot-runtime.exe\" : \"copilot-runtime\";\n    const prebuildDir = join(packageRoot, \"prebuilds\", platform);\n    const wrapper = join(prebuildDir, wrapperName);\n    try {\n        validateRuntimeBundle(wrapper, join(prebuildDir, \"runtime.node\"));\n    } catch (error) {\n        throw new Error(\n            `${packageName} is missing required Copilot CLI runtime files. Reinstall @github/copilot-sdk.`,\n            { cause: error }\n        );\n    }\n    makeExecutable(wrapper);\n    return wrapper;\n}\n","sourceCodeStart":270,"sourceCodeEnd":296,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/runtimeArtifacts.ts#L270-L296","documentation":"After locating the platform package, ensureRuntimeBundle validates the wrapper binary and runtime.node via validateRuntimeBundle. If that validation throws (missing or empty files), it is wrapped in this clearer error with the original as `cause`, telling the user to reinstall @github/copilot-sdk. This indicates a present-but-broken platform package.","triggerScenarios":"validateRuntimeBundle(wrapper, prebuildDir/runtime.node) throws because copilot-runtime(.exe) or runtime.node is missing or 0-byte inside the resolved platform package's prebuilds/<platform> directory.","commonSituations":"Interrupted npm installs leaving partial prebuilds, antivirus quarantining the wrapper .exe, bundlers/webpack stripping binary assets, docker COPY layers excluding prebuild files via .dockerignore.","solutions":["Reinstall: rm -rf node_modules package-lock.json && npm install @github/copilot-sdk.","Check antivirus/EDR logs for quarantined copilot-runtime binaries and whitelist the path.","Ensure packaging (dockerignore, bundler config, CI artifact rules) does not exclude prebuilds/.","Inspect the wrapped `cause` error to see which specific file is missing or empty."],"exampleFix":"// before\nprebuilds/linux-x64/  # copilot-runtime missing (0 files)\n\n// after\nrm -rf node_modules package-lock.json && npm install\n# verify: ls node_modules/@github/copilot-linux-x64/prebuilds/linux-x64","handlingStrategy":"validation","validationCode":"import { existsSync, statSync } from 'fs';\nconst dir = `node_modules/${pkg}/prebuilds/${platform}`;\nfor (const f of ['copilot-runtime', 'runtime.node']) {\n  const p = `${dir}/${f}`;\n  if (!existsSync(p) || statSync(p).size === 0) throw new Error(`${f} missing/empty in ${dir}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const path = runtimePath();\n} catch (e) {\n  if (e.message.includes('missing required Copilot CLI runtime files')) {\n    console.error('corrupt platform package; reinstall. cause:', e.cause);\n  } else throw e;\n}","preventionTips":["Inspect e.cause to identify the exact missing file.","Exclude no prebuilds/ files in .dockerignore/bundler/CI artifact configs.","Whitelist runtime binaries in antivirus/EDR policies."],"tags":["npm","corrupted-install","missing-artifact","install","nodejs"],"backgroundTag":"missing-optional-dependency","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}