apache/druid · error · RuntimeException

Failed to announce serviceId [" + serviceId + "]

Error message

Failed to announce serviceId [" + serviceId + "]

What it means

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.

Solutions

  1. Check connectivity/TLS and ACLs between Druid and the Consul agent (host/port).
  2. Inspect the attached cause and Consul agent logs; monitor the consul/announce/failure metric.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java:197 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/305ba9487106f7b9. Report an issue: GitHub.

Appendix: source

Thrown at extensions-contrib/consul-extensions/src/main/java/org/apache/druid/consul/discovery/ConsulDruidNodeAnnouncer.java:197

      );
    }
    catch (Exception e) {
      // Cleanup partial registration if Consul was updated before failure
      try {
        consulApiClient.deregisterService(serviceId);
      }
      catch (Exception cleanup) {
        LOGGER.debug(cleanup, "Cleanup deregister failed for serviceId [%s] after announce error", serviceId);
      }

      LOGGER.error(e, "Exception during announce for DiscoveryDruidNode[%s]", discoveryDruidNode);
      ConsulMetrics.emitCount(
          emitter,
          "consul/announce/failure",
          "role",
          discoveryDruidNode.getNodeRole().getJsonName()
      );
      throw new RuntimeException("Failed to announce serviceId [" + serviceId + "]", e);
    }
    finally {
      registeringNodes.remove(serviceId);
    }
  }

  private void registerServiceWithRetry(String serviceId, DiscoveryDruidNode discoveryDruidNode) throws Exception
  {
    RetryUtils.retry(
        () -> {
          consulApiClient.registerService(discoveryDruidNode);
          return null;
        },
        ConsulDruidNodeAnnouncer::isTransientConsulFailure,
        1,
        MAX_ANNOUNCE_REGISTRATION_TRIES,
        null,
        "Registering Consul service [" + serviceId + "] failed"

View on GitHub (pinned to 9b90983fd2)