github/copilot-sdk · error
workingDirectory is not supported with…
Error message
workingDirectory is not supported with RuntimeConnection.forInProcess(): the in-process transport hosts the runtime in this process, so honoring it would require mutating the shared process-global cwd. Change the host process's working directory before constructing the client instead.
What it means
After the session.create RPC completes, CopilotClient._register_inline() raises this RuntimeError if the response contains no session (sessionId). A well-formed server response must include a session id so the client can register and track the new session; a missing one indicates a malformed or unexpected server reply.
Solutions
- Check client and copilot CLI/server versions and align them (the response schema may differ across versions).
- Inspect the raw session.create response (enable debug logging) to see what the server returned.
- Retry session creation; if it persists, report/fix the server-side response-shape regression.
- Bypass proxies/intermediaries that may alter the RPC response body.
Example fix
// before resp = await client.create_session(model="gpt-4o") # empty sessionId // after # update CLI/server to a matching version, then: session = await client.create_session(model="gpt-4o") assert session.session_id
Defensive patterns
Strategy: try-catch
Type guard
def response_has_session(response: dict) -> bool:
return bool(response.get("sessionId")) Try / catch
try:
session = await client.create_session(...)
except RuntimeError as e:
if "sessionId" in str(e):
... # log raw RPC response, retry once, then escalate Prevention
- Keep copilot CLI/server and SDK versions aligned.
- Enable debug logging around session.create in integration tests.
- Avoid intermediaries that can rewrite or truncate RPC responses.
When it happens
Trigger: The backend responds to session.create without a sessionId/session payload - e.g. server/CLI version mismatch, an error-shaped response treated as success, or a proxy returning an empty 200 body.
Common situations: Running against an older or newer copilot CLI server whose session.create reply shape differs; a gateway stripping the response body; transient backend faults producing empty replies.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- env is not supported with RuntimeConnection.forInProcess()…
- session.create response did not include a sessionId.
- No session found for sessionId
- Copilot request response used after RPC connection closed.
- No canvas registered with id
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/8149df612ccfff2a.
Report an issue: GitHub.
Appendix: source
Thrown at nodejs/src/client.ts:613
constructor(options: CopilotClientOptions = {}) {
// Resolve the connection mode. `_internalConnection` is set by
// `joinSession()` to opt into the parent-process stdio path; consumers
// should always go through the public `connection` field.
const conn: InternalRuntimeConnection =
options._internalConnection ??
options.connection ??
CopilotClient.resolveDefaultConnection();
if (
conn.kind === "uri" &&
(options.gitHubToken !== undefined || options.useLoggedInUser !== undefined)
) {
throw new Error(
"gitHubToken and useLoggedInUser cannot be used with RuntimeConnection.forUri (external server manages its own auth)"
);
}
if (conn.kind === "inprocess" && options.workingDirectory !== undefined) {
throw new Error(
"workingDirectory is not supported with RuntimeConnection.forInProcess(): the in-process " +
"transport hosts the runtime in this process, so honoring it would require mutating the " +
"shared process-global cwd. Change the host process's working directory before " +
"constructing the client instead."
);
}
if (conn.kind === "inprocess" && options.env !== undefined) {
throw new Error(
"env is not supported with RuntimeConnection.forInProcess(): the in-process transport loads " +
"the native runtime into the shared host process, whose single environment block cannot " +
"carry per-client values. Set the variables on the host process environment instead."
);
}
if (conn.kind === "inprocess" && options.telemetry !== undefined) {
throw new Error(
"telemetry is not supported with RuntimeConnection.forInProcess(): telemetry configuration " +
"is lowered to environment variables read by native runtime code running in the shared " +
"host process, so per-client telemetry cannot be honored in-process. Configure telemetry " +View on GitHub (pinned to cd8cf15dc3)