ethereum/go-ethereum · error
nil TextMapPropagator configured
Error message
nil TextMapPropagator configured
What it means
WithTextMapPropagator panics when passed a nil propagator. This client option enables OpenTelemetry trace-context propagation (the traceparent header); because the client does not propagate by default, the option stores the propagator unconditionally, so a nil value is rejected as a configuration programming error at DialOptions time.
Source
Thrown at rpc/client_opt.go:109
func WithHeaders(headers http.Header) ClientOption {
return optionFunc(func(cfg *clientConfig) {
cfg.initHeaders()
for k, vs := range headers {
cfg.httpHeaders[k] = vs
}
})
}
// WithTextMapPropagator configures OpenTelemetry trace propagation.
// Note, by default, trace context is NOT propagated by rpc.Client.
// To enable propagation via the `traceparent` header, you must explicitly
// enable it by setting a propagator, e.g.
//
// prop := propagation.TraceContext{}
// c, err := rpc.DialOptions(ctx, "http://", rpc.WithTextMapPropagator(prop))
func WithTextMapPropagator(tmp propagation.TextMapPropagator) ClientOption {
if tmp == nil {
panic("nil TextMapPropagator configured")
}
return optionFunc(func(cfg *clientConfig) {
cfg.tmprop = tmp
})
}
// WithHTTPClient configures the http.Client used by the RPC client.
func WithHTTPClient(c *http.Client) ClientOption {
return optionFunc(func(cfg *clientConfig) {
cfg.httpClient = c
})
}
// WithHTTPAuth configures HTTP request authentication. The given provider will be called
// whenever a request is made. Note that only one authentication provider can be active at
// any time.
func WithHTTPAuth(a HTTPAuth) ClientOption {
if a == nil {View on GitHub (pinned to 6bb0588ad8)
Solutions
- Pass a concrete propagator, e.g. rpc.WithTextMapPropagator(propagation.TraceContext{}).
- If tracing is optional, guard the call: only append the option when the propagator is non-nil.
- Ensure the OpenTelemetry SDK is initialized before reading a global propagator.
Example fix
// before
var prop propagation.TextMapPropagator // nil when tracing disabled
c, err := rpc.DialOptions(ctx, url, rpc.WithTextMapPropagator(prop))
// after
var opts []rpc.ClientOption
if prop != nil {
opts = append(opts, rpc.WithTextMapPropagator(prop))
}
c, err := rpc.DialOptions(ctx, url, opts...) Defensive patterns
Strategy: validation
Validate before calling
var opts []rpc.ClientOption
if prop != nil { // skip option entirely when tracing disabled
opts = append(opts, rpc.WithTextMapPropagator(prop))
}
c, err := rpc.DialOptions(ctx, url, opts...) Prevention
- Only append WithTextMapPropagator when the propagator is non-nil.
- Initialize the OTel SDK (which installs a global propagator) before building clients.
- Unit-test the option-building function with the 'tracing disabled' config path.
When it happens
Trigger: Calling rpc.DialOptions(ctx, url, rpc.WithTextMapPropagator(nil)) or passing a propagator variable declared as var prop propagation.TextMapPropagator and never assigned.
Common situations: Making tracing optional in application config and forwarding a nil when tracing is disabled; passing an uninitialized struct field from a config struct; refactoring from a global otel.GetTextMapPropagator() that returned nil before OTel SDK initialization.
Related errors
- nil auth
- channel given to Subscribe must not be nil
- can't create multiple subscriptions with Notifier
- can't create subscription after subscribe call has returned
- can't Notify before subscription is created
AI-assisted analysis of ethereum/go-ethereum@6bb0588ad8 (2026-08-15).
Data as JSON: /api/errors/bd36fa775bca307c.
Report an issue: GitHub.