openzipkin/zipkin · error · NullPointerException
overrides == null
Error message
overrides == null
What it means
KafkaCollector.Builder.overrides(Map) throws NullPointerException when the map argument is null. Overrides let you replace any consumer config property (e.g. auto.offset.reset=latest) on top of the builder defaults; the guard is a simple null check before properties.putAll(overrides).
Source
Thrown at zipkin-collector/kafka/src/main/java/zipkin2/collector/kafka/KafkaCollector.java:126
}
/**
* 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
* Map<String, String> overrides = new LinkedHashMap<>();
* overrides.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG, "latest");
* builder.overrides(overrides);
* }</pre>
*
* @see org.apache.kafka.clients.consumer.ConsumerConfig
*/
public final Builder overrides(Map<String, ?> overrides) {
if (overrides == null) throw new NullPointerException("overrides == null");
properties.putAll(overrides);
return this;
}
@Override
public KafkaCollector build() {
return new KafkaCollector(this);
}
Builder() {
// Settings below correspond to "New Consumer Configs"
// https://kafka.apache.org/documentation/#newconsumerconfigs
properties.put(GROUP_ID_CONFIG, "zipkin");
properties.put(AUTO_OFFSET_RESET_CONFIG, "earliest");
properties.put(KEY_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());
properties.put(VALUE_DESERIALIZER_CLASS_CONFIG, ByteArrayDeserializer.class.getName());
}
}View on GitHub (pinned to 878ce2a1fa)
Solutions
- Pass an empty map instead of null when no overrides are needed (an empty map is accepted; putAll is a no-op)
- Guard the call: if (overrides != null) builder.overrides(overrides)
- Fix the config loader to return an empty map by default
Example fix
// before builder.overrides(config.getKafkaOverrides()); // returns null when section absent // after builder.overrides(config.getKafkaOverrides() != null ? config.getKafkaOverrides() : Collections.emptyMap());
Defensive patterns
Strategy: type-guard
Validate before calling
Map<String, ?> overrides = config.kafkaOverrides(); if (overrides != null) builder.overrides(overrides);
Type guard
static boolean hasOverrides(Map<String, ?> m) { return m != null && !m.isEmpty(); } Prevention
- Treat overrides as optional: skip the setter instead of passing null
- Make config loaders return empty maps, never null, for optional sections
When it happens
Trigger: Calling .overrides(null), or passing a Map field that was never initialized (common when overrides are optional and the config loader returns null for a missing section).
Common situations: Treating overrides as optional: a config binding produces null when no overrides are defined, and the caller forwards it unconditionally.
Related errors
- bootstrapServers == null
- groupId == null
- serviceUrl is null or empty
- sessionFactory == null
- metrics == null
AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14).
Data as JSON: /api/errors/7518d9ab4f254762.
Report an issue: GitHub.