diff --git a/internal/telemetry/optout.go b/internal/telemetry/optout.go index aa5cf011d..5a2cf8dfc 100644 --- a/internal/telemetry/optout.go +++ b/internal/telemetry/optout.go @@ -132,6 +132,12 @@ func (s *Service) SendOptOutBeacon(ctx context.Context) error { } req.Header.Set("Content-Type", "application/json") + // The beacon is fire-and-forget from NotifyConfigChanged, so a Service + // built without a client (test literals do this) must not take the + // goroutine — and the test binary — down with a nil dereference. + if s.client == nil { + return errors.New("send opt-out beacon: no HTTP client configured") + } resp, err := s.client.Do(req) if err != nil { return fmt.Errorf("send opt-out beacon: %w", err)