{"record":{"id":"305ba9487106f7b9","repo":"apache/druid","slug":"failed-to-announce-serviceid-serviceid","errorCode":null,"errorMessage":"Failed to announce serviceId [\" + serviceId + \"]","messagePattern":"Failed to announce serviceId \\[\" \\+ serviceId \\+ \"\\]","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java","lineNumber":197,"sourceCode":"      );\n    }\n    catch (Exception e) {\n      // Cleanup partial registration if Consul was updated before failure\n      try {\n        consulApiClient.deregisterService(serviceId);\n      }\n      catch (Exception cleanup) {\n        LOGGER.debug(cleanup, \"Cleanup deregister failed for serviceId [%s] after announce error\", serviceId);\n      }\n\n      LOGGER.error(e, \"Exception during announce for DiscoveryDruidNode[%s]\", discoveryDruidNode);\n      ConsulMetrics.emitCount(\n          emitter,\n          \"consul/announce/failure\",\n          \"role\",\n          discoveryDruidNode.getNodeRole().getJsonName()\n      );\n      throw new RuntimeException(\"Failed to announce serviceId [\" + serviceId + \"]\", e);\n    }\n    finally {\n      registeringNodes.remove(serviceId);\n    }\n  }\n\n  private void registerServiceWithRetry(String serviceId, DiscoveryDruidNode discoveryDruidNode) throws Exception\n  {\n    RetryUtils.retry(\n        () -> {\n          consulApiClient.registerService(discoveryDruidNode);\n          return null;\n        },\n        ConsulDruidNodeAnnouncer::isTransientConsulFailure,\n        1,\n        MAX_ANNOUNCE_REGISTRATION_TRIES,\n        null,\n        \"Registering Consul service [\" + serviceId + \"] failed\"","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java#L179-L215","documentation":"announce() caught an exception while registering the service with Consul; it cleans up any partial registration, logs the error, emits the consul/announce/failure metric, and propagates this failure naming the serviceId.","triggerScenarios":"Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java:197 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check connectivity/TLS and ACLs between Druid and the Consul agent (host/port).","Inspect the attached cause and Consul agent logs; monitor the consul/announce/failure metric."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}