{"record":{"id":"aa332a4a7ebf68c1","repo":"github/copilot-sdk","slug":"unsupported-runtimeconnection-type-type-name","errorCode":null,"errorMessage":"Unsupported RuntimeConnection type: <type name>","messagePattern":"Unsupported RuntimeConnection type: <type name>","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Client.cs","lineNumber":185,"sourceCode":"                tcp.ConnectionToken ??= Guid.NewGuid().ToString();\n                break;\n\n            case UriRuntimeConnection uri:\n                if (string.IsNullOrEmpty(uri.Url))\n                {\n                    throw new ArgumentException(\"UriRuntimeConnection.Url must be a non-empty string.\", nameof(options));\n                }\n                if (!string.IsNullOrEmpty(_options.GitHubToken) || _options.UseLoggedInUser != null)\n                {\n                    throw new ArgumentException(\"GitHubToken and UseLoggedInUser cannot be combined with RuntimeConnection.ForUri (the existing runtime manages its own auth).\", nameof(options));\n                }\n                var parsed = ParseRuntimeUrl(uri.Url);\n                _optionsHost = parsed.Host.Trim('[', ']');\n                _optionsPort = parsed.Port;\n                break;\n\n            default:\n                throw new ArgumentException($\"Unsupported RuntimeConnection type: {_connection.GetType().Name}\", nameof(options));\n        }\n\n        ValidateEnvironmentOptions(_options, _connection);\n\n        _logger = _options.Logger ?? NullLogger.Instance;\n        _onListModels = _options.OnListModels;\n\n        _clientGlobalApis = BuildClientGlobalApis();\n\n        // Empty mode: validate at construction time that the app supplied a\n        // per-session persistence location. The runtime is mode-agnostic, so\n        // without this check it would silently fall back to ~/.copilot, which\n        // defeats the point of empty mode for multi-tenant scenarios.\n        if (_options.Mode == CopilotClientMode.Empty)\n        {\n            var hasPersistence =\n                !string.IsNullOrEmpty(_options.BaseDirectory) ||\n                _options.SessionFs is not null ||","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/dotnet/src/Client.cs#L167-L203","documentation":"The constructor switches on the concrete RuntimeConnection type (in-process, TCP, URI) and its default branch rejects any unrecognized connection implementation with ArgumentException, naming the type. Only SDK-supported connection types are accepted.","triggerScenarios":"new CopilotClient(options) where options.Connection is a custom class deriving from RuntimeConnection (or an unsupported built-in) that the switch does not handle.","commonSituations":"Implementing a custom RuntimeConnection subclass expecting the SDK to honor it; upgrading the SDK where an older connection type was dropped; passing the wrong concrete type due to a factory bug.","solutions":["Use one of the supported connections: InProcessRuntimeConnection, TcpRuntimeConnection, or UriRuntimeConnection/ForUri","Remove the custom RuntimeConnection subclass or contribute support upstream","Check the SDK version's supported connection types after an upgrade"],"exampleFix":"// before\noptions.Connection = new MyCustomConnection();\n// after\noptions.Connection = new TcpRuntimeConnection();","handlingStrategy":"validation","validationCode":"if (options.Connection is { } c && c is not InProcessRuntimeConnection && c is not TcpRuntimeConnection && c is not UriRuntimeConnection) throw new InvalidOperationException($\"Unsupported connection type {c.GetType().Name}\");","typeGuard":null,"tryCatchPattern":"try { client = new CopilotClient(options); } catch (ArgumentException ex) when (ex.Message.Contains(\"Unsupported RuntimeConnection\")) { options.Connection = new TcpRuntimeConnection(); client = new CopilotClient(options); }","preventionTips":["Only use SDK-provided connection types","After SDK upgrades, verify custom connection types are still supported","Centralize connection construction in one factory"],"tags":["dotnet","validation","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"}