{"record":{"id":"c132b13dd954292a","repo":"SonarSource/sonarqube","slug":"failed-to-publish-telemetry-event","errorCode":null,"errorMessage":"Failed to publish {} telemetry event","messagePattern":"Failed to publish (.+?) telemetry event","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/event/AnalyticsEventPublisher.java","lineNumber":65,"sourceCode":"\n  public AnalyticsEventPublisher(EventAsyncClient eventAsyncClient, EventSourceBuilder eventSourceBuilder, Configuration configuration) {\n    this.eventAsyncClient = eventAsyncClient;\n    this.eventSourceBuilder = eventSourceBuilder;\n    this.configuration = configuration;\n  }\n\n  /**\n   * Publishes a single event. No-op when telemetry is disabled.\n   */\n  public void publish(AnalyticsEventType type, Object payload) {\n    if (!isTelemetryEnabled()) {\n      return;\n    }\n    try {\n      eventAsyncClient.publishCrossDomainEvent(toEvent(type, payload))\n        .whenComplete((ignored, throwable) -> {\n          if (throwable != null) {\n            LOG.warn(\"Failed to publish {} telemetry event\", type.eventType(), throwable);\n          }\n        });\n    } catch (RuntimeException e) {\n      LOG.warn(\"Failed to publish {} telemetry event\", type.eventType(), e);\n    }\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))","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-telemetry-core/src/main/java/org/sonar/telemetry/core/event/AnalyticsEventPublisher.java#L47-L83","documentation":"AnalyticsEventPublisher.publish sends a single cross-domain telemetry event asynchronously via the event async client. Failures — whether a RuntimeException thrown synchronously by the client or a throwable completing the future — are logged with this warning and swallowed: telemetry is best-effort and never impacts the product.","triggerScenarios":"publish(type, payload) is called when eventAsyncClient.publishCrossDomainEvent throws (sync, e.g. client misconfigured/closed) or its returned CompletableFuture completes exceptionally (async network/transport failure).","commonSituations":"Telemetry endpoint unreachable or blocked by firewall/proxy; telemetry client initialization failed; expired TLS certificates; server offline during background telemetry publish.","solutions":["Check outbound network access/HTTPS proxy settings from the SonarQube host to the telemetry endpoint","Verify telemetry configuration (SONAR_TELEMETRY_ENABLE and related URL settings) is correct","Inspect the attached throwable in the log for the root cause and fix (DNS, TLS, proxy auth)","If telemetry must be disabled, set SONAR_TELEMETRY_ENABLE=false to stop publish attempts"],"exampleFix":"# sonar.properties\n# before (default, publish failing due to blocked egress)\n# after: allow egress to telemetry.sonarsource.com:443 or disable\nsonar.telemetry.enable=false","handlingStrategy":"try-catch","validationCode":"if (!publisher.isTelemetryEnabled()) return; // skip publish entirely","typeGuard":null,"tryCatchPattern":"try {\n  client.publishCrossDomainEvent(event)\n    .whenComplete((ignored, throwable) -> {\n      if (throwable != null) log.warn(\"Telemetry publish failed: {}\", throwable.toString());\n    });\n} catch (RuntimeException e) {\n  log.warn(\"Telemetry publish failed synchronously: {}\", e.toString());\n}","preventionTips":["Treat telemetry as best-effort: never let it propagate failures to business logic","Pre-verify network egress to the telemetry endpoint in restricted environments","Disable telemetry explicitly when the host has no internet access"],"tags":["telemetry","network","async","sonarqube"],"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"}