{"record":{"id":"8cd67efb859a3524","repo":"github/copilot-sdk","slug":"unknown-runtimeconnection-type-t","errorCode":null,"errorMessage":"unknown RuntimeConnection type: %T","messagePattern":"unknown RuntimeConnection type: %T","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":286,"sourceCode":"\t\t\tclient.cliArgs = append([]string{}, conn.Args...)\n\t\t}\n\t\tclient.port = conn.Port\n\t\tclient.tcpConnectionToken = conn.ConnectionToken\n\tcase URIConnection:\n\t\tif conn.URL == \"\" {\n\t\t\tpanic(\"URIConnection requires a non-empty URL\")\n\t\t}\n\t\thost, port := parseCLIURL(conn.URL)\n\t\tclient.actualHost = host\n\t\tclient.actualPort = port\n\t\tclient.isExternalServer = true\n\t\tclient.useStdio = false\n\t\tclient.tcpConnectionToken = conn.ConnectionToken\n\tcase InProcessConnection:\n\t\tclient.useStdio = false\n\t\tclient.useInProcess = true\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unknown RuntimeConnection type: %T\", connection))\n\t}\n\n\t// Validate transport-specific option constraints (fail loud). The in-process\n\t// transport loads the runtime into this process, whose single environment\n\t// block, process-global working directory, and shared telemetry state cannot\n\t// carry per-client values. Child-process transports may set env via either\n\t// the client-level option or the connection, but not both.\n\tvalidateEnvironmentOptions(connection, &opts)\n\n\t// Validate auth options when connecting to an external runtime.\n\tif client.isExternalServer && (opts.GitHubToken != \"\" || opts.UseLoggedInUser != nil) {\n\t\tpanic(\"GitHubToken and UseLoggedInUser cannot be used with URIConnection (external runtime manages its own auth)\")\n\t}\n\n\t// For child-process transports, a connection-level env takes precedence over\n\t// the client-level env (setting both was rejected above). Resolve it before\n\t// defaulting so an explicit empty connection env stays authoritative.\n\tif cp, ok := connection.(childProcessConnection); ok {","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L268-L304","documentation":"NewClient panics when the Connection option implements RuntimeConnection with a type the SDK does not recognize. The connection switch in NewClient handles StdioConnection, TCPConnection, URIConnection and InProcessConnection; anything else falls to the default branch. This is almost always a custom connection type or a value that does not actually implement the intended interface.","triggerScenarios":"Passing a user-defined struct (or a wrongly-typed value, e.g. *MyConn vs MyConn, or a nil typed pointer) as Options.Connection so it satisfies RuntimeConnection but matches no known case. Panic at go/client.go:286 with the Go type in the message (%T).","commonSituations":"Wrapping a connection to intercept traffic; upgrading the SDK where an older custom connection type is no longer a recognized case; passing nil interface vs typed nil confusion.","solutions":["Use one of the supported connection types: StdioConnection, TCPConnection, URIConnection, or InProcessConnection.","Remove custom wrappers; configure behavior via ClientOptions instead.","Check the %T value in the panic message against the SDK's exported connection types after upgrading."],"exampleFix":"// before\nclient := clientpkg.NewClient(&clientpkg.Options{Connection: myLoggingConn{inner: clientpkg.StdioConnection{}}})\n// after\nclient := clientpkg.NewClient(&clientpkg.Options{\n    Connection: clientpkg.StdioConnection{},\n    // custom behavior via options/hooks instead of a wrapper type\n})","handlingStrategy":"type-guard","validationCode":"switch c := opts.Connection.(type) {\ncase clientpkg.StdioConnection, clientpkg.TCPConnection, clientpkg.URIConnection, clientpkg.InProcessConnection:\n    // ok\ncase nil:\n    // default transport\ndefault:\n    return fmt.Errorf(\"unsupported connection type %T\", c)\n}","typeGuard":"func isSupportedConnection(c clientpkg.RuntimeConnection) bool {\n    switch c.(type) {\n    case clientpkg.StdioConnection, clientpkg.TCPConnection, clientpkg.URIConnection, clientpkg.InProcessConnection:\n        return true\n    }\n    return false\n}","tryCatchPattern":null,"preventionTips":["Only use the SDK's exported connection types.","Re-check custom wrappers after SDK upgrades for dropped interface cases.","Beware typed-nil pointers implementing interfaces; pass concrete values."],"tags":["go","panic","type-mismatch","connection","api-misuse"],"backgroundTag":"type-mismatch","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"}