openzipkin/zipkin · error · NullPointerException

queue == null

Error message

queue == null

What it means

RabbitMQCollector.Builder.queue(String) throws NullPointerException on a null queue name. The queue (default 'zipkin-spans') is what the consumers subscribe to; the builder rejects null so the declaration/subscription step never receives an invalid name. Empty string is not rejected here — only null.

Source

Thrown at zipkin-collector/rabbitmq/src/main/java/zipkin2/collector/rabbitmq/RabbitMQCollector.java:90

    public Builder addresses(List<String> addresses) {
      this.addresses = convertAddresses(addresses);
      return this;
    }

    public Builder concurrency(int concurrency) {
      this.concurrency = concurrency;
      return this;
    }

    public Builder connectionFactory(ConnectionFactory connectionFactory) {
      if (connectionFactory == null) throw new NullPointerException("connectionFactory == null");
      this.connectionFactory = connectionFactory;
      return this;
    }

    /** Queue zipkin spans will be consumed from. Defaults to "zipkin-spans". */
    public Builder queue(String queue) {
      if (queue == null) throw new NullPointerException("queue == null");
      this.queue = queue;
      return this;
    }

    @Override
    public RabbitMQCollector build() {
      return new RabbitMQCollector(this);
    }
  }

  final String queue;
  final LazyInit connection;

  RabbitMQCollector(Builder builder) {
    this.queue = builder.queue;
    this.connection = new LazyInit(builder);
  }

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Pass a concrete queue name, e.g. .queue("zipkin-spans")
  2. Default the config: getOrDefault("rabbitmq.queue", "zipkin-spans")
  3. Omit the call to keep the built-in default 'zipkin-spans'

Example fix

// before
builder.queue(props.getProperty("rabbitmq.queue")); // null when key missing

// after
builder.queue(props.getProperty("rabbitmq.queue", "zipkin-spans"));
Defensive patterns

Strategy: validation

Validate before calling

String queue = props.getProperty("rabbitmq.queue", "zipkin-spans");
if (queue == null) throw new IllegalStateException("rabbitmq.queue must not be null");
builder.queue(queue);

Prevention

When it happens

Trigger: Calling .queue(null) — e.g. reading the queue name from a config key that is absent, or a variable left null on a code path that still calls the builder.

Common situations: Renaming the queue per environment with a missing key in one environment's config file.

Related errors


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