github/copilot-sdk · error
Telemetry is not supported with InProcessConnection…
Error message
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.
What it means
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.
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.
Example fix
// before
client := clientpkg.NewClient(&clientpkg.Options{
Connection: clientpkg.InProcessConnection{},
Telemetry: &clientpkg.TelemetryOptions{Endpoint: "http://collector:4318"},
})
// after
os.Setenv("OTEL_EXPORTER_OTLP_ENDPOINT", "http://collector:4318")
client := clientpkg.NewClient(&clientpkg.Options{
Connection: clientpkg.InProcessConnection{},
}) Defensive patterns
Strategy: validation
Validate before calling
if _, isInProc := opts.Connection.(clientpkg.InProcessConnection); isInProc && opts.Telemetry != nil {
return fmt.Errorf("Telemetry is unsupported with InProcessConnection; configure via host env")
} Type guard
func isInProcess(c clientpkg.RuntimeConnection) bool { _, ok := c.(clientpkg.InProcessConnection); return ok } Prevention
- 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.
When it happens
Trigger: Calling NewClient with Connection: InProcessConnection{} and a non-nil Options.Telemetry. Panics inside validateEnvironmentOptions (go/client.go:117), reached via NewClient.
Common situations: 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.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- WorkingDirectory is not supported with InProcessConnection…
- Env is not supported with InProcessConnection: the…
- Set environment variables via either the client-level Env…
- GitHubToken and UseLoggedInUser cannot be used with…
- err.Error()
AI-assisted analysis of github/copilot-sdk@cd8cf15dc3 (2026-09-09).
Data as JSON: /api/errors/46454364a3dbaca7.
Report an issue: GitHub.
Appendix: source
Thrown at go/client.go:117
// per-client environment, working directory, and telemetry. It panics (fails
// loud) on a misconfiguration, matching the other SDKs.
//
// The in-process transport loads the native runtime into this process, whose
// single environment block and process-global working directory cannot carry
// per-client values, and whose telemetry lowers to shared process-global env
// vars — so options that depend on them are rejected there. Child-process
// transports each own their OS process, so per-connection env is allowed, but
// setting it in both the client-level option and the connection is rejected.
func validateEnvironmentOptions(connection RuntimeConnection, opts *ClientOptions) {
if _, ok := connection.(InProcessConnection); ok {
if opts.Env != nil {
panic("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.")
}
if opts.WorkingDirectory != "" {
panic("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.")
}
if opts.Telemetry != nil {
panic("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.")
}
return
}
if cp, ok := connection.(childProcessConnection); ok {
if cp.connEnv() != nil && opts.Env != nil {
panic("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.")
}
}
}
// Client manages the connection to the Copilot CLI server and provides session management.
//
// The Client can either spawn a CLI server process or connect to an existing server.
// It handles JSON-RPC communication, session lifecycle, tool execution, and permission requests.
//
// Example:
//View on GitHub (pinned to cd8cf15dc3)