openzipkin/zipkin · error · NullPointerException

groupId == null

Error message

groupId == null

What it means

KafkaCollector.Builder.groupId(String) throws NullPointerException when passed null. The group id identifies the consumer group this process consumes on behalf of (default "zipkin"); the builder requires a non-null override. Fail-fast at builder time so an invalid consumer group never reaches Kafka.

Source

Thrown at zipkin-collector/kafka/src/main/java/zipkin2/collector/kafka/KafkaCollector.java:99

     * Topic zipkin spans will be consumed from. Defaults to "zipkin". Multiple topics may be
     * specified if comma delimited.
     */
    public Builder topic(String topic) {
      if (topic == null) throw new NullPointerException("topic == null");
      this.topic = topic;
      return this;
    }

    /** The bootstrapServers connect string, ex. 127.0.0.1:9092. No default. */
    public Builder bootstrapServers(String bootstrapServers) {
      if (bootstrapServers == null) throw new NullPointerException("bootstrapServers == null");
      properties.put(BOOTSTRAP_SERVERS_CONFIG, bootstrapServers);
      return this;
    }

    /** The consumer group this process is consuming on behalf of. Defaults to "zipkin" */
    public Builder groupId(String groupId) {
      if (groupId == null) throw new NullPointerException("groupId == null");
      properties.put(GROUP_ID_CONFIG, groupId);
      return this;
    }

    /** Count of threads consuming the topic. Defaults to 1 */
    public Builder streams(int streams) {
      this.streams = streams;
      return this;
    }

    /**
     * By default, a consumer will be built from properties derived from builder defaults, as well
     * as "auto.offset.reset" -> "earliest". Any properties set here will override the consumer
     * config.
     *
     * <p>For example: Only consume spans since you connected by setting the below.
     *
     * <pre>{@code

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Pass a concrete group id, e.g. .groupId("zipkin") or your service's group name
  2. If sourced from properties, default it: props.getProperty("group.id", "zipkin")
  3. Skip the groupId() call entirely to keep the built-in default of "zipkin"

Example fix

// before
builder.groupId(props.getProperty("group.id")); // null when key absent

// after
builder.groupId(props.getProperty("group.id", "zipkin"));
Defensive patterns

Strategy: validation

Validate before calling

String groupId = props.getProperty("group.id", "zipkin");
if (groupId == null) throw new IllegalStateException("group.id must not be null");
builder.groupId(groupId);

Prevention

When it happens

Trigger: Calling .groupId(null) on KafkaCollector.Builder, typically with a value sourced from a config key that is absent (e.g. getProperty("group.id") returning null).

Common situations: Mapping Kafka consumer properties into the zipkin collector builder and a missing group.id key, or conditionally setting a group id where the condition leaves the variable null.

Related errors


AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14). Data as JSON: /api/errors/11cf1bd3ddb8c89b. Report an issue: GitHub.