{"record":{"id":"95ebc5e9ae153587","repo":"github/copilot-sdk","slug":"env-is-not-supported-with-runtimeconnection-forinp","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":621,"sourceCode":"\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 \" +\n                    \"via the host process environment, or use a child-process transport.\"\n            );\n        }\n        if (\n            (conn.kind === \"stdio\" || conn.kind === \"tcp\") &&\n            conn.env !== undefined &&\n            options.env !== undefined\n        ) {","sourceCodeStart":603,"sourceCodeEnd":639,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L603-L639","documentation":"When the caller supplies a local_session_id to create_session, the client generates the session id client-side and asks the server to use it. _register_inline() raises this RuntimeError if the server's session.create response returns a different sessionId than requested, meaning the server ignored or overrode the caller-supplied id.","triggerScenarios":"Calling create_session(..., local_session_id=\"my-id\") while the connected server assigns its own session ids (e.g. a cloud session path where the server reserves id assignment, or a server build that doesn't honor client-supplied ids).","commonSituations":"Passing a local_session_id with a cloud session backend; server/client version mismatch where local id support differs; duplicate/conflicting ids causing the server to reissue one.","solutions":["Omit local_session_id and use the server-assigned sessionId from the returned session.","Use the non-cloud/local session path where client-supplied ids are honored.","Align CLI/server versions so session.create supports caller-requested sessionIds.","Ensure the requested id is unique/valid if the server replaces colliding ids."],"exampleFix":"// before\nsession = await client.create_session(local_session_id=\"fixed-id\")\n// after\nsession = await client.create_session()  # use session.session_id from the server","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def returned_requested_id(response: dict, local_session_id) -> bool:\n    return local_session_id is None or response.get(\"sessionId\") == local_session_id","tryCatchPattern":"try:\n    session = await client.create_session(local_session_id=my_id)\nexcept RuntimeError as e:\n    if \"returned sessionId\" in str(e):\n        session = await client.create_session()  # accept server-assigned id\n        my_id = session.session_id","preventionTips":["Only pass local_session_id on session paths/backends that honor client-supplied ids.","Treat the server's sessionId as authoritative once the call returns.","Test id-pinning behavior against your target server version."],"tags":["rpc","session-id","response-validation"],"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"}