{"record":{"id":"e342bea15d3f56c9","repo":"github/copilot-sdk","slug":"working-directory-is-not-supported-with-runtimecon","errorCode":null,"errorMessage":"working_directory is not supported with RuntimeConnection.for_inprocess(): the native runtime shares the host process working directory, so a per-client working directory cannot be honored in-process. Use a child-process transport, or set the process working directory before creating the client.","messagePattern":"working_directory is not supported with RuntimeConnection\\.for_inprocess\\(\\): the native runtime shares the host process working directory, so a per-client working directory cannot be honored in-process\\. Use a child-process transport, or set the process working directory before creating the client\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":1505,"sourceCode":"    \"\"\"\n    if isinstance(connection, InProcessRuntimeConnection):\n        if options.env is not None:\n            raise ValueError(\n                \"env is not supported with RuntimeConnection.for_inprocess(): the \"\n                \"in-process transport loads the native runtime into the shared host \"\n                \"process, whose single environment block cannot carry per-client \"\n                \"values. Set the variables on the host process environment instead.\"\n            )\n        if options.telemetry is not None:\n            raise ValueError(\n                \"telemetry is not supported with RuntimeConnection.for_inprocess(): \"\n                \"telemetry configuration is lowered to environment variables read by \"\n                \"native runtime code running in the shared host process, so per-client \"\n                \"telemetry cannot be honored in-process. Configure telemetry via the \"\n                \"host process environment, or use a child-process transport.\"\n            )\n        if options.working_directory is not None:\n            raise ValueError(\n                \"working_directory is not supported with RuntimeConnection.for_inprocess(): \"\n                \"the native runtime shares the host process working directory, so a \"\n                \"per-client working directory cannot be honored in-process. Use a \"\n                \"child-process \"\n                \"transport, or set the process working directory before creating the client.\"\n            )\n        return\n\n    if (\n        isinstance(connection, ChildProcessRuntimeConnection)\n        and connection.env is not None\n        and options.env is not None\n    ):\n        raise ValueError(\n            \"Set environment variables via either the client-level env argument or \"\n            \"ChildProcessRuntimeConnection.env, not both. Prefer the connection-level \"\n            \"env for child-process transports.\"\n        )","sourceCodeStart":1487,"sourceCodeEnd":1523,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L1487-L1523","documentation":"The native runtime shares the host process working directory in the in-process transport, so a per-client working_directory cannot be honored. Passing options.working_directory with an in-process connection raises ValueError to avoid silently using the wrong directory.","triggerScenarios":"Creating CopilotClient with RuntimeConnection.for_inprocess() and a non-None working_directory in _CopilotClientOptions.","commonSituations":"Per-project tooling that sets a working directory per session; refactoring a stdio-based client to in-process while keeping directory customization.","solutions":["Remove working_directory and call os.chdir() on the host process before creating the client","Switch to RuntimeConnection.for_stdio() for per-client working directories"],"exampleFix":"// before\nclient = CopilotClient(connection=RuntimeConnection.for_inprocess(), working_directory=\"/repo\")\n// after\nos.chdir(\"/repo\")\nclient = CopilotClient(connection=RuntimeConnection.for_inprocess())","handlingStrategy":"validation","validationCode":"if isinstance(conn, InProcessRuntimeConnection) and opts.working_directory is not None:\n    raise ValueError(\"working_directory is unsupported for in-process; os.chdir() instead\")","typeGuard":"def supports_client_workdir(conn) -> bool:\n    return not isinstance(conn, InProcessRuntimeConnection)","tryCatchPattern":"try:\n    client = CopilotClient(connection=conn, working_directory=wd)\nexcept ValueError as e:\n    if \"working_directory is not supported\" in str(e):\n        os.chdir(wd); wd = None\n        client = CopilotClient(connection=conn)","preventionTips":["Call os.chdir() before in-process client creation instead of passing working_directory","Prefer for_stdio when per-client directories are a hard requirement","Avoid mixing in-process and multi-project session setups"],"tags":["python","in-process","working-directory","configuration"],"backgroundTag":"unsupported-operation","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"}