{"record":{"id":"8149df612ccfff2a","repo":"github/copilot-sdk","slug":"workingdirectory-is-not-supported-with-runtimeconn","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":613,"sourceCode":"    constructor(options: CopilotClientOptions = {}) {\n        // Resolve the connection mode. `_internalConnection` is set by\n        // `joinSession()` to opt into the parent-process stdio path; consumers\n        // should always go through the public `connection` field.\n        const conn: InternalRuntimeConnection =\n            options._internalConnection ??\n            options.connection ??\n            CopilotClient.resolveDefaultConnection();\n\n        if (\n            conn.kind === \"uri\" &&\n            (options.gitHubToken !== undefined || options.useLoggedInUser !== undefined)\n        ) {\n            throw new Error(\n                \"gitHubToken and useLoggedInUser cannot be used with RuntimeConnection.forUri (external server manages its own auth)\"\n            );\n        }\n        if (conn.kind === \"inprocess\" && options.workingDirectory !== undefined) {\n            throw new Error(\n                \"workingDirectory is not supported with RuntimeConnection.forInProcess(): the in-process \" +\n                    \"transport hosts the runtime in this process, so honoring it would require mutating the \" +\n                    \"shared process-global cwd. Change the host process's working directory before \" +\n                    \"constructing the client instead.\"\n            );\n        }\n        if (conn.kind === \"inprocess\" && options.env !== undefined) {\n            throw new Error(\n                \"env is not supported with RuntimeConnection.forInProcess(): the in-process transport loads \" +\n                    \"the native runtime into the shared host process, whose single environment block cannot \" +\n                    \"carry per-client values. Set the variables on the host process environment instead.\"\n            );\n        }\n        if (conn.kind === \"inprocess\" && options.telemetry !== undefined) {\n            throw new Error(\n                \"telemetry is not supported with RuntimeConnection.forInProcess(): telemetry configuration \" +\n                    \"is lowered to environment variables read by native runtime code running in the shared \" +\n                    \"host process, so per-client telemetry cannot be honored in-process. Configure telemetry \" +","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L595-L631","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nresp = await client.create_session(model=\"gpt-4o\")  # empty sessionId\n// after\n# update CLI/server to a matching version, then:\nsession = await client.create_session(model=\"gpt-4o\")\nassert session.session_id","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def response_has_session(response: dict) -> bool:\n    return bool(response.get(\"sessionId\"))","tryCatchPattern":"try:\n    session = await client.create_session(...)\nexcept RuntimeError as e:\n    if \"sessionId\" in str(e):\n        ...  # log raw RPC response, retry once, then escalate","preventionTips":["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."],"tags":["rpc","response-validation","server"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}