{"record":{"id":"46454364a3dbaca7","repo":"github/copilot-sdk","slug":"telemetry-is-not-supported-with-inprocessconnectio","errorCode":null,"errorMessage":"Telemetry is not supported with InProcessConnection: telemetry configuration is lowered to environment variables read by native runtime code running in the shared host process, so per-client telemetry cannot be honored in-process. Configure telemetry via the host process environment, or use a child-process transport.","messagePattern":"Telemetry is not supported with InProcessConnection: telemetry configuration is lowered to environment variables read by native runtime code running in the shared host process, so per-client telemetry cannot be honored in-process\\. Configure telemetry via the host process environment, or use a child-process transport\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/client.go","lineNumber":117,"sourceCode":"// per-client environment, working directory, and telemetry. It panics (fails\n// loud) on a misconfiguration, matching the other SDKs.\n//\n// The in-process transport loads the native runtime into this process, whose\n// single environment block and process-global working directory cannot carry\n// per-client values, and whose telemetry lowers to shared process-global env\n// vars — so options that depend on them are rejected there. Child-process\n// transports each own their OS process, so per-connection env is allowed, but\n// setting it in both the client-level option and the connection is rejected.\nfunc validateEnvironmentOptions(connection RuntimeConnection, opts *ClientOptions) {\n\tif _, ok := connection.(InProcessConnection); ok {\n\t\tif opts.Env != nil {\n\t\t\tpanic(\"Env is not supported with InProcessConnection: the in-process transport loads the native runtime into the shared host process, whose single environment block cannot carry per-client values. Set the variables on the host process environment instead.\")\n\t\t}\n\t\tif opts.WorkingDirectory != \"\" {\n\t\t\tpanic(\"WorkingDirectory is not supported with InProcessConnection: the native runtime shares the host process working directory. Use a child-process transport, or set the process working directory before creating the client.\")\n\t\t}\n\t\tif opts.Telemetry != nil {\n\t\t\tpanic(\"Telemetry is not supported with InProcessConnection: telemetry configuration is lowered to environment variables read by native runtime code running in the shared host process, so per-client telemetry cannot be honored in-process. Configure telemetry via the host process environment, or use a child-process transport.\")\n\t\t}\n\t\treturn\n\t}\n\n\tif cp, ok := connection.(childProcessConnection); ok {\n\t\tif cp.connEnv() != nil && opts.Env != nil {\n\t\t\tpanic(\"Set environment variables via either the client-level Env option or the connection's Env, not both. Prefer the connection-level Env for child-process transports.\")\n\t\t}\n\t}\n}\n\n// Client manages the connection to the Copilot CLI server and provides session management.\n//\n// The Client can either spawn a CLI server process or connect to an existing server.\n// It handles JSON-RPC communication, session lifecycle, tool execution, and permission requests.\n//\n// Example:\n//","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/go/client.go#L99-L135","documentation":"NewClient panics when ClientOptions.Telemetry is set while using InProcessConnection. Telemetry configuration is lowered to environment variables read by native runtime code, and in-process the runtime lives in the shared host process, so per-client telemetry settings cannot be isolated or honored.","triggerScenarios":"Calling NewClient with Connection: InProcessConnection{} and a non-nil Options.Telemetry. Panics inside validateEnvironmentOptions (go/client.go:117), reached via NewClient.","commonSituations":"Teams enable custom telemetry (OTLP endpoint, opt-out flags) for stdio-based clients, then migrate to the in-process transport without removing the Telemetry option.","solutions":["Remove the Telemetry option when using InProcessConnection.","Configure telemetry via the host process environment variables instead (e.g. set the relevant OTLP/telemetry env vars before process start).","Switch to StdioConnection{} if per-client telemetry configuration is required."],"exampleFix":"// before\nclient := clientpkg.NewClient(&clientpkg.Options{\n    Connection: clientpkg.InProcessConnection{},\n    Telemetry:  &clientpkg.TelemetryOptions{Endpoint: \"http://collector:4318\"},\n})\n// after\nos.Setenv(\"OTEL_EXPORTER_OTLP_ENDPOINT\", \"http://collector:4318\")\nclient := clientpkg.NewClient(&clientpkg.Options{\n    Connection: clientpkg.InProcessConnection{},\n})","handlingStrategy":"validation","validationCode":"if _, isInProc := opts.Connection.(clientpkg.InProcessConnection); isInProc && opts.Telemetry != nil {\n    return fmt.Errorf(\"Telemetry is unsupported with InProcessConnection; configure via host env\")\n}","typeGuard":"func isInProcess(c clientpkg.RuntimeConnection) bool { _, ok := c.(clientpkg.InProcessConnection); return ok }","tryCatchPattern":null,"preventionTips":["Set telemetry via host-process environment variables when running in-process.","Document in your bootstrap code which options are stdio-only.","Fail at config-load time, before NewClient, when in-process + telemetry is detected."],"tags":["go","panic","in-process-transport","telemetry","configuration"],"backgroundTag":"conflicting-config-options","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"}