github/copilot-sdk · error
Could not resolve for Copilot CLI .
Error message
Could not resolve ${packageName} for Copilot CLI ${version}. What it means
In the npm-package resolution path (COPILOT_CLI_USE_NPM_PACKAGE builds), ensureRuntimeBundle locates the per-platform package @github/copilot-<platform> via resolvePackageRoot. When it cannot be found it throws, naming the package and CLI version, because the bundled runtime.node is the only way to run Copilot CLI in this mode.
Solutions
- Install/restore the platform package matching getRuntimePlatform() output.
- Reinstall with optional dependencies enabled: npm install (avoid --omit=optional).
- Pass options.packageSearchPaths pointing at the node_modules roots that actually contain the package.
- For pnpm/PnP setups, add the platform package as a direct dependency so the linker keeps it.
Example fix
// before npm install @github/copilot-sdk --omit=optional // after npm install @github/copilot-sdk @github/copilot-linux-x64
Defensive patterns
Strategy: validation
Validate before calling
import { resolvePackageRoot } from './runtimeArtifacts';
if (!resolvePackageRoot('@github/copilot-linux-x64', searchPaths)) throw new Error('platform package not installed'); Try / catch
try {
const path = getBundledRuntimePath();
} catch (e) {
if (e.message.startsWith('Could not resolve @github/copilot-')) {
// install the named platform package or fix packageSearchPaths
} else throw e;
} Prevention
- Add the platform package as a direct dependency in monorepos/pnpm setups.
- Never install with --omit=optional.
- Sanity-check resolution of the platform package in a startup health check.
When it happens
Trigger: ensureRuntimeBundle (via getBundledRuntimePath/runtimePath) runs with the npm-package flag enabled and no entry for @github/copilot-<platform> in packageSearchPaths/node_modules.
Common situations: Internal canary builds installed without their platform package, pnpm/yarn PnP layouts not covered by search paths, trimmed production installs (--omit=optional), monorepo hoisting moving the package elsewhere.
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
- Could not resolve . Reinstall @github/copilot-sdk so its…
- is missing required Copilot CLI runtime files. Reinstall…
- The in-process runtime connection is closed.
- Failed to write a frame to the in-process runtime…
- not found at .
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/7cb2bb0de71aee0e.
Report an issue: GitHub.
Appendix: source
Thrown at nodejs/src/runtimeArtifacts.ts:262
packageName: string,
searchPaths = require.resolve.paths(packageName) ?? []
): string | undefined {
return searchPaths
.map((base) => join(base, ...packageName.split("/")))
.find((candidate) => existsSync(join(candidate, "package.json")));
}
export async function ensureRuntimeBundle(
version: string,
options: EnsureRuntimeBundleOptions = {}
): Promise<string> {
const platform = options.platform ?? getRuntimePlatform();
// lgtm[js/trivial-conditional] This generated constant is true for internal canary builds.
if (COPILOT_CLI_USE_NPM_PACKAGE) {
const packageName = `@github/copilot-${platform}`;
const packageRoot = resolvePackageRoot(packageName, options.packageSearchPaths);
if (!packageRoot) {
throw new Error(`Could not resolve ${packageName} for Copilot CLI ${version}.`);
}
validateFile(
join(packageRoot, "prebuilds", platform, "runtime.node"),
"Copilot runtime.node"
);
return materializeRuntimeBundle(
{ packageRoot, platform },
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.`
);View on GitHub (pinned to cd8cf15dc3)