jaegertracing/jaeger · error

error creating reader client connection: %w

Error message

error creating reader client connection: %w

What it means

The factory failed to establish the gRPC client connection used by the trace reader (and metrics/query reader path). The underlying dial error is wrapped, so the cause (DNS, TLS, auth, unreachable server) is inside the chain.

Source

Thrown at internal/storage/v2/grpc/factory.go:161

	}

	baseOpts := []grpc.DialOption{
		grpc.WithChainUnaryInterceptor(unaryInterceptors...),
		grpc.WithChainStreamInterceptor(streamInterceptors...),
	}
	if f.config.MaxRecvMsgSizeMiB > 0 {
		baseOpts = append(baseOpts, grpc.WithDefaultCallOptions(
			grpc.MaxCallRecvMsgSize(f.config.MaxRecvMsgSizeMiB*1024*1024),
		))
	}

	createConn := func(telset component.TelemetrySettings, gcs *configgrpc.ClientConfig) (*grpc.ClientConn, error) {
		return newClient(telset, gcs, baseOpts...)
	}

	readerConn, err := createConn(readerTelset, readerConfig)
	if err != nil {
		return fmt.Errorf("error creating reader client connection: %w", err)
	}
	writerConn, err := createConn(writerTelset, writerConfig)
	if err != nil {
		_ = readerConn.Close()
		return fmt.Errorf("error creating writer client connection: %w", err)
	}

	f.readerConn, f.writerConn = readerConn, writerConn

	return nil
}

View on GitHub (pinned to 806f444784)

Solutions

  1. Read the wrapped cause to identify dial vs TLS vs auth failure
  2. Verify the reader endpoint and that the remote storage server is reachable (nc/curl the port)
  3. Check TLS settings: ca, cert, key files and server name override
  4. Ensure auth credentials (bearer token file) are configured if required

Example fix

// before
grpc:
  endpoint: remote-storage:17271
// after (correct port)
grpc:
  endpoint: remote-storage:17271
  tls:
    insecure: true
Defensive patterns

Strategy: validation

Validate before calling

// before creating the factory
timeout, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
conn, err := grpc.NewClient(readerCfg.Endpoint, ...)
if err != nil || pingFails(timeout, conn) { /* endpoint unreachable */ }

Try / catch

err := factory.Initialize()
if err != nil {
    var wrapped error
    if errors.As(err, &wrapped) {
        log.Printf("reader conn failure cause: %v", wrapped)
    }
    return err
}

Prevention

When it happens

Trigger: initializeConnections calls createConn for the reader's ClientConfig and the gRPC dial fails: bad endpoint, TLS misconfiguration, dead server, invalid credentials.

Common situations: Wrong reader endpoint host/port; remote storage not started; TLS certificate/CA mismatch; bearer token not supplied when auth is required.

Understand the failure class

Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/bdc7d4e6bbf628a1. Report an issue: GitHub.