openzipkin/zipkin · error · NullPointerException
keys == null
Error message
keys == null
What it means
MySQLStorage.Builder.autocompleteKeys throws NullPointerException when passed a null list. The builder deliberately fails fast on null instead of storing it, because autocompleteKey tagging is optional but must be a well-formed list. Passing null is treated as a programming error, not an empty configuration.
Source
Thrown at zipkin-storage/mysql-v1/src/main/java/zipkin2/storage/mysql/v1/MySQLStorage.java:53
boolean strictTraceId = true, searchEnabled = true;
private DataSource datasource;
private Settings settings = new Settings().withRenderSchema(false);
private ExecuteListenerProvider listenerProvider;
private Executor executor;
List<String> autocompleteKeys = new ArrayList<>();
@Override public Builder strictTraceId(boolean strictTraceId) {
this.strictTraceId = strictTraceId;
return this;
}
@Override public Builder searchEnabled(boolean searchEnabled) {
this.searchEnabled = searchEnabled;
return this;
}
@Override public Builder autocompleteKeys(List<String> keys) {
if (keys == null) throw new NullPointerException("keys == null");
this.autocompleteKeys = keys;
return this;
}
public Builder datasource(DataSource datasource) {
if (datasource == null) throw new NullPointerException("datasource == null");
this.datasource = datasource;
return this;
}
public Builder settings(Settings settings) {
if (settings == null) throw new NullPointerException("settings == null");
this.settings = settings;
return this;
}
public Builder listenerProvider(@Nullable ExecuteListenerProvider listenerProvider) {
this.listenerProvider = listenerProvider;View on GitHub (pinned to 878ce2a1fa)
Solutions
- Pass an empty list (List.of()) when no autocomplete keys are needed.
- Default the config value before it reaches the builder, e.g. keys != null ? keys : List.of().
- Fix the property source so the mapped value is never null (provide a default in application.yaml or the environment).
Example fix
// before builder.autocompleteKeys(null); // after builder.autocompleteKeys(keys == null ? List.of() : keys);
Defensive patterns
Strategy: validation
Validate before calling
builder.autocompleteKeys(keys == null ? List.of() : keys);
Prevention
- Normalize null lists to empty lists at the config-binding layer
- Treat builder NPEs in zipkin as configuration bugs: fail loudly in one bootstrap method
When it happens
Trigger: Calling builder.autocompleteKeys(null), or wiring the value from config/environment that resolves to null (e.g. a missing property mapped with @Value or a Map.get that returned null).
Common situations: Property-driven configuration where zipkin.storage.mysql.autocomplete-keys is absent, so the binding produces null; refactoring that removes the list initialization; copying from another storage module whose builder tolerated null.
Related errors
AI-assisted analysis of openzipkin/zipkin@878ce2a1fa (2026-08-14).
Data as JSON: /api/errors/b28c4c15afcab17a.
Report an issue: GitHub.