github/copilot-sdk · error

Path to Copilot CLI is required. Please supply it via…

Error message

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.

What it means

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." thrown in github/copilot-sdk.

Solutions

  1. Pass the CLI path explicitly: RuntimeConnection.forStdio({ path: '/path/to/copilot' }) or forTcp({ path })
  2. Set the COPILOT_CLI_PATH environment variable to the CLI executable
  3. Use RuntimeConnection.forUri(...) to attach to an already-running runtime instead of launching one
  4. Verify the CLI is installed and the path is executable
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at nodejs/src/client.ts:2642 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/592c8437e1d3654a. Report an issue: GitHub.

Appendix: source

Thrown at nodejs/src/client.ts:2642

                this.options.sessionIdleTimeoutSeconds !== undefined &&
                this.options.sessionIdleTimeoutSeconds > 0
            ) {
                args.push(
                    "--session-idle-timeout",
                    this.options.sessionIdleTimeoutSeconds.toString()
                );
            }

            if (this.options.enableRemoteSessions) {
                args.push("--remote");
            }

            // 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"]

View on GitHub (pinned to cd8cf15dc3)