{"record":{"id":"4f1722e3343fde28","repo":"github/copilot-sdk","slug":"invalid-env-var-name-value-value-expected","errorCode":null,"errorMessage":"Invalid <env var name> value '<value>'. Expected 'inprocess', 'stdio', or unset.","messagePattern":"Invalid <env var name> value '<value>'\\. Expected 'inprocess', 'stdio', or unset\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Client.cs","lineNumber":304,"sourceCode":"    /// Resolves the default <see cref=\"RuntimeConnection\"/> for the no-Connection case,\n    /// honoring <see cref=\"DefaultConnectionEnvVar\"/>.\n    /// </summary>\n    private static RuntimeConnection ResolveDefaultConnection(CopilotClientOptions options)\n    {\n        var value = options.Environment is not null\n            && options.Environment.TryGetValue(DefaultConnectionEnvVar, out var fromOptions)\n                ? fromOptions\n                : Environment.GetEnvironmentVariable(DefaultConnectionEnvVar);\n\n        if (string.IsNullOrEmpty(value) || string.Equals(value, \"stdio\", StringComparison.OrdinalIgnoreCase))\n        {\n            return RuntimeConnection.ForStdio();\n        }\n        if (string.Equals(value, \"inprocess\", StringComparison.OrdinalIgnoreCase))\n        {\n            return RuntimeConnection.ForInProcess();\n        }\n        throw new ArgumentException(\n            $\"Invalid {DefaultConnectionEnvVar} value '{value}'. Expected 'inprocess', 'stdio', or unset.\");\n    }\n\n    /// <summary>\n    /// Parses a runtime URL into a URI with host and port.\n    /// </summary>\n    /// <param name=\"url\">The URL to parse. Supports formats: \"port\", \"host:port\", \"[ipv6]:port\", \"http://host:port\".</param>\n    private static Uri ParseRuntimeUrl(string url)\n    {\n        // If it's just a port number, treat as localhost\n        if (int.TryParse(url, out var port))\n        {\n            return new Uri($\"http://localhost:{port}\");\n        }\n\n        // Add scheme if missing\n        if (!url.StartsWith(\"http://\", StringComparison.OrdinalIgnoreCase) &&\n            !url.StartsWith(\"https://\", StringComparison.OrdinalIgnoreCase))","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/dotnet/src/Client.cs#L286-L322","documentation":"ResolveDefaultConnection throws this ArgumentException when the environment variable named by DefaultConnectionEnvVar is set to a value other than 'inprocess', 'stdio', or unset/empty. The variable selects the default runtime connection; unknown values are rejected with this message listing the valid options.","triggerScenarios":"Creating a CopilotClient without an explicit RuntimeConnection while the DefaultConnectionEnvVar environment variable contains a typo or unsupported value, e.g. 'IN-PROCESS', 'ipc', 'ffi', or 'true'.","commonSituations":"Typos in CI/CD or launch profiles; users guessing at values like 'in_process' or 'childprocess'; stale variables left from experiments with older SDK versions.","solutions":["Set the environment variable to exactly 'inprocess' or 'stdio' (case-insensitive).","Unset or clear the variable to use the library default.","Pass an explicit RuntimeConnection (ForStdio/ForInProcess) in code so the env var is not consulted."],"exampleFix":"// before\nset COPILOT_SDK_CONNECTION=in_process   // invalid\n// after\nset COPILOT_SDK_CONNECTION=inprocess   // or 'stdio', or unset","handlingStrategy":"validation","validationCode":"var v = Environment.GetEnvironmentVariable(DefaultConnectionEnvVar);\nif (v is not (null or \"\") && !string.Equals(v, \"inprocess\", StringComparison.OrdinalIgnoreCase) && !string.Equals(v, \"stdio\", StringComparison.OrdinalIgnoreCase))\n    throw new ArgumentException($\"{DefaultConnectionEnvVar} must be 'inprocess' or 'stdio'.\");","typeGuard":"static bool IsValidConnectionEnvValue(string? v) => string.IsNullOrWhiteSpace(v) || v.Equals(\"inprocess\", StringComparison.OrdinalIgnoreCase) || v.Equals(\"stdio\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { client = new CopilotClient(options); }\ncatch (ArgumentException ex) when (ex.Message.Contains(DefaultConnectionEnvVar)) { client = new CopilotClient(options, RuntimeConnection.ForStdio()); }","preventionTips":["Validate env config at deployment/CI time","Pass an explicit RuntimeConnection in code to bypass the env var","Document allowed values ('inprocess', 'stdio') wherever the variable is set"],"tags":["dotnet","environment-variables","configuration","cli"],"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"}