github/copilot-sdk · error

is missing required Copilot CLI runtime files. Reinstall…

Error message

${packageName} is missing required Copilot CLI runtime files. Reinstall @github/copilot-sdk.

What it means

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.

Solutions

  1. Reinstall: rm -rf node_modules package-lock.json && npm install @github/copilot-sdk.
  2. Check antivirus/EDR logs for quarantined copilot-runtime binaries and whitelist the path.
  3. Ensure packaging (dockerignore, bundler config, CI artifact rules) does not exclude prebuilds/.
  4. Inspect the wrapped `cause` error to see which specific file is missing or empty.

Example fix

// before
prebuilds/linux-x64/  # copilot-runtime missing (0 files)

// after
rm -rf node_modules package-lock.json && npm install
# verify: ls node_modules/@github/copilot-linux-x64/prebuilds/linux-x64
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync, statSync } from 'fs';
const dir = `node_modules/${pkg}/prebuilds/${platform}`;
for (const f of ['copilot-runtime', 'runtime.node']) {
  const p = `${dir}/${f}`;
  if (!existsSync(p) || statSync(p).size === 0) throw new Error(`${f} missing/empty in ${dir}`);
}

Try / catch

try {
  const path = runtimePath();
} catch (e) {
  if (e.message.includes('missing required Copilot CLI runtime files')) {
    console.error('corrupt platform package; reinstall. cause:', e.cause);
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Interrupted npm installs leaving partial prebuilds, antivirus quarantining the wrapper .exe, bundlers/webpack stripping binary assets, docker COPY layers excluding prebuild files via .dockerignore.

Understand the failure class

Background: "X is not installed. Please install it with pip install Y": missing optional dependency errors — ImportError/ValueError raised when a library's optional extra was never installed — this error's family across 22 libraries.

Related errors


AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09). Data as JSON: /api/errors/1ca487bb3afa8968. Report an issue: GitHub.

Appendix: source

Thrown at nodejs/src/runtimeArtifacts.ts:288

            options.cacheRoot,
            `${version}-${platform}`
        );
    }

    const packageName = getRuntimePackageName(platform);
    const packageRoot = resolvePackageRoot(packageName, options.packageSearchPaths);
    if (!packageRoot) {
        throw new Error(
            `Could not resolve ${packageName}. Reinstall @github/copilot-sdk so its platform package is installed.`
        );
    }
    const wrapperName = platform.startsWith("win32") ? "copilot-runtime.exe" : "copilot-runtime";
    const prebuildDir = join(packageRoot, "prebuilds", platform);
    const wrapper = join(prebuildDir, wrapperName);
    try {
        validateRuntimeBundle(wrapper, join(prebuildDir, "runtime.node"));
    } catch (error) {
        throw new Error(
            `${packageName} is missing required Copilot CLI runtime files. Reinstall @github/copilot-sdk.`,
            { cause: error }
        );
    }
    makeExecutable(wrapper);
    return wrapper;
}

View on GitHub (pinned to cd8cf15dc3)