{"record":{"id":"c7c11134c13352fd","repo":"github/copilot-sdk","slug":"invalid-value-r-expected-inprocess-stdio","errorCode":null,"errorMessage":"Invalid {value!r}. Expected 'inprocess', 'stdio', or unset.","messagePattern":"Invalid (.+?)\\. Expected 'inprocess', 'stdio', or unset\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/copilot/client.py","lineNumber":1472,"sourceCode":"_DEFAULT_CONNECTION_ENV_VAR = \"COPILOT_SDK_DEFAULT_CONNECTION\"\n\n\ndef _resolve_default_connection(env: Mapping[str, str]) -> RuntimeConnection:\n    \"\"\"Resolve the transport when the caller supplies no explicit connection.\n\n    Honors the ``COPILOT_SDK_DEFAULT_CONNECTION`` override (``\"inprocess\"`` or\n    ``\"stdio\"``); defaults to stdio. Matches the Node/.NET/Rust default-transport\n    override so the CI matrix can run the whole suite under either transport.\n    \"\"\"\n    value = env.get(_DEFAULT_CONNECTION_ENV_VAR)\n    if value is None or value == \"\":\n        return RuntimeConnection.for_stdio()\n    normalized = value.strip().lower()\n    if normalized == \"inprocess\":\n        return RuntimeConnection.for_inprocess()\n    if normalized == \"stdio\":\n        return RuntimeConnection.for_stdio()\n    raise ValueError(\n        f\"Invalid {_DEFAULT_CONNECTION_ENV_VAR}={value!r}. Expected 'inprocess', 'stdio', or unset.\"\n    )\n\n\ndef _validate_environment_options(\n    options: _CopilotClientOptions, connection: RuntimeConnection\n) -> None:\n    \"\"\"Validate env/telemetry/working-directory options against the transport.\n\n    Per-client environment is only representable for child-process transports\n    (each client owns its own OS process). The in-process (FFI) transport loads\n    the native runtime into the shared host process, whose single environment\n    block and process-global working directory cannot carry per-client values,\n    so options that lower to them are rejected there (fail loud, not silent).\n    \"\"\"\n    if isinstance(connection, InProcessRuntimeConnection):\n        if options.env is not None:\n            raise ValueError(","sourceCodeStart":1454,"sourceCodeEnd":1490,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/python/copilot/client.py#L1454-L1490","documentation":"When no explicit connection is supplied, the client reads the default connection kind from an environment variable (_DEFAULT_CONNECTION_ENV_VAR, e.g. COPILOT_CONNECTION). Only 'inprocess' or 'stdio' (case-insensitive) are accepted; anything else raises ValueError.","triggerScenarios":"Setting the connection environment variable to a typo like 'in-proces', 'stdio ' with stray characters already stripped but wrong words like 'child-process', or leaving a stale value like 'tcp' in the environment.","commonSituations":"Typo in .env or CI config; copying an env var from another project; a variable set by an old script version before 'inprocess' was supported.","solutions":["Set the env var to exactly 'inprocess' or 'stdio' (case-insensitive)","Unset the env var to fall back to the default (stdio) connection","Check shell profiles/CI files for typos in the variable's value"],"exampleFix":"// before\nexport COPILOT_CONNECTION=in-process\n// after\nexport COPILOT_CONNECTION=inprocess","handlingStrategy":"validation","validationCode":"v = os.environ.get(\"COPILOT_CONNECTION\", \"\")\nassert v.lower() in (\"\", \"inprocess\", \"stdio\"), f\"bad COPILOT_CONNECTION={v!r}\"","typeGuard":"def is_valid_connection_value(v: str | None) -> bool:\n    return v is None or v.strip().lower() in (\"inprocess\", \"stdio\")","tryCatchPattern":"try:\n    client = CopilotClient()\nexcept ValueError as e:\n    if \"Expected 'inprocess', 'stdio'\" in str(e):\n        os.environ.pop(\"COPILOT_CONNECTION\", None)\n        client = CopilotClient()","preventionTips":["Pin the env var value in .env/CI with exactly 'inprocess' or 'stdio'","Add a startup lint that validates known env vars","Never hand-edit the value; use the documented constants"],"tags":["python","environment","configuration"],"backgroundTag":"invalid-env-var-value","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"}