{"record":{"id":"55716ceae6aaf178","repo":"SonarSource/sonarqube","slug":"failed-to-publish-telemetry-events","errorCode":null,"errorMessage":"Failed to publish {} telemetry events","messagePattern":"Failed to publish (.+?) telemetry events","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/event/AnalyticsEventPublisher.java","lineNumber":88,"sourceCode":"    }\n  }\n\n  /**\n   * Publishes each payload as its own event, in a single batch. No-op on empty input or when\n   * telemetry is disabled.\n   */\n  public void publishAll(AnalyticsEventType type, Collection<?> payloads) {\n    if (payloads.isEmpty() || !isTelemetryEnabled()) {\n      return;\n    }\n    try {\n      List<Event<?>> events = payloads.stream()\n        .<Event<?>>map(payload -> toEvent(type, payload))\n        .toList();\n      eventAsyncClient.publishCrossDomainEvents(events)\n        .whenComplete((ignored, throwable) -> {\n          if (throwable != null) {\n            LOG.warn(\"Failed to publish {} telemetry events\", type.eventType(), throwable);\n          }\n        });\n    } catch (RuntimeException e) {\n      LOG.warn(\"Failed to publish {} telemetry events\", type.eventType(), e);\n    }\n  }\n\n  public boolean isTelemetryEnabled() {\n    return configuration.getBoolean(SONAR_TELEMETRY_ENABLE.getKey()).orElse(false);\n  }\n\n  private Event<?> toEvent(AnalyticsEventType type, Object payload) {\n    return new BaseEvent<>(\n      new EventMetadata(\n        eventSourceBuilder.build(type.sourceDomain(), type.sourceService()),\n        type.eventType(),\n        type.eventVersion()),\n      payload);","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/event/AnalyticsEventPublisher.java#L70-L106","documentation":"AnalyticsEventPublisher.publishAll sends a batch of telemetry events (one Event per payload) asynchronously via publishCrossDomainEvents. Sync RuntimeExceptions from the client and async failures surfaced in whenComplete are logged with this warning and swallowed — batching is best-effort.","triggerScenarios":"publishAll(type, payloads) called with a non-empty payload list; publishCrossDomainEvents throws synchronously or its CompletableFuture completes exceptionally.","commonSituations":"Batch too large for the transport/endpoint; telemetry endpoint unreachable; client shut down while batch publish in flight; proxy blocking bulk HTTPS requests.","solutions":["Check the logged throwable for the root cause","Verify egress/proxy configuration for the telemetry endpoint and any request size limits","Retry with fewer payloads to rule out batch-size issues","Set sonar.telemetry.enable=false if telemetry connectivity cannot be fixed"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!publisher.isTelemetryEnabled() || payloads.isEmpty()) return;","typeGuard":null,"tryCatchPattern":"try {\n  client.publishCrossDomainEvents(events)\n    .whenComplete((ignored, t) -> { if (t != null) log.warn(\"batch publish failed\", t); });\n} catch (RuntimeException e) {\n  log.warn(\"batch publish failed (sync)\", e);\n}","preventionTips":["Keep batches modest in size to avoid transport limits","Validate endpoint reachability before enabling batched telemetry","Log the throwable to distinguish size errors from network errors"],"tags":["telemetry","network","batch","async"],"backgroundTag":"telemetry-publish-failed","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}