github/copilot-sdk · error

Copilot CLI not found at

Error message

Copilot CLI not found at ${this.resolvedCliPath}. Set COPILOT_CLI_PATH to use a custom installation.

What it means

Thrown by CopilotClient at spawn time when the resolved Copilot CLI executable does not exist on disk. The SDK resolves the CLI from the default install location or COPILOT_CLI_PATH; if the file is missing there it cannot launch the runtime subprocess, so it fails fast before any transport is opened.

Solutions

  1. Install the GitHub Copilot CLI (e.g. `npm install -g @github/copilot`) so the default lookup path resolves
  2. Set the COPILOT_CLI_PATH environment variable to the absolute path of the CLI executable
  3. Pass an explicit path via RuntimeConnection.forStdio({ path }) or RuntimeConnection.forTcp({ path })
  4. Verify the resolved path exists and is executable (check permissions, or a deleted install after an upgrade)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nodejs/src/client.ts:2653 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at nodejs/src/client.ts:2653

            }

            // Suppress debug/trace output that might pollute stdout, and apply the
            // shared runtime env (auth token, connection token, COPILOT_HOME, telemetry).
            const envWithoutNodeDebug = this.buildRuntimeEnv();

            if (!this.resolvedCliPath) {
                throw new Error(
                    "Path to Copilot CLI is required. Please supply it via " +
                        "`RuntimeConnection.forStdio({ path })` or " +
                        "`RuntimeConnection.forTcp({ path })`, set the COPILOT_CLI_PATH " +
                        "environment variable, or use `RuntimeConnection.forUri(...)` to " +
                        "connect to an already-running runtime."
                );
            }

            // Verify CLI exists before attempting to spawn
            if (!existsSync(this.resolvedCliPath)) {
                throw new Error(
                    `Copilot CLI not found at ${this.resolvedCliPath}. Set COPILOT_CLI_PATH to use a custom installation.`
                );
            }

            const stdioConfig: ["pipe", "pipe", "pipe"] | ["ignore", "pipe", "pipe"] =
                this.connectionConfig.kind === "stdio"
                    ? ["pipe", "pipe", "pipe"]
                    : ["ignore", "pipe", "pipe"];

            // For .js files, spawn node explicitly; for executables, spawn directly
            const isJsFile = this.resolvedCliPath.endsWith(".js");
            if (isJsFile) {
                this.cliProcess = spawn(getNodeExecPath(), [this.resolvedCliPath, ...args], {
                    stdio: stdioConfig,
                    cwd: this.options.workingDirectory,
                    env: envWithoutNodeDebug,
                    windowsHide: true,
                });

View on GitHub (pinned to cd8cf15dc3)