openzipkin/zipkin · error · NullPointerException

key == null

Error message

key == null

What it means

CassandraAutocompleteTags.getValues(String) throws NullPointerException ('key == null') when a null tag key is passed to look up autocomplete tag values. The storage API requires a concrete tag key to query the autocomplete table, so null is rejected immediately rather than propagated into a Cassandra query.

Source

Thrown at zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraAutocompleteTags.java:30

  final boolean enabled;
  final Call<List<String>> keysCall;
  final SelectAutocompleteValues.Factory valuesCallFactory;

  CassandraAutocompleteTags(CassandraStorage storage) {
    enabled = storage.searchEnabled
      && !storage.autocompleteKeys.isEmpty()
      && storage.metadata().hasAutocompleteTags;
    keysCall = Call.create(List.copyOf(storage.autocompleteKeys));
    valuesCallFactory = enabled ? new SelectAutocompleteValues.Factory(storage.session()) : null;
  }

  @Override public Call<List<String>> getKeys() {
    if (!enabled) return Call.emptyList();
    return keysCall.clone();
  }

  @Override public Call<List<String>> getValues(String key) {
    if (key == null) throw new NullPointerException("key == null");
    if (key.isEmpty()) throw new IllegalArgumentException("key was empty");
    if (!enabled) return Call.emptyList();
    return valuesCallFactory.create(key);
  }
}

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Pass a non-null tag key that is also in the configured autocompleteKeys list, e.g. getValues("env")
  2. Validate/skip the lookup at the caller when the key is null or empty
  3. Fix the upstream request handler to reject missing key parameters with 400 instead of reaching storage

Example fix

// before
Call<List<String>> values = storage.autocompleteTags().getValues(key); // key may be null

// after
if (key == null || key.isEmpty()) {
  return Collections.emptyList(); // or return 400 to the caller
}
Call<List<String>> values = storage.autocompleteTags().getValues(key);
Defensive patterns

Strategy: type-guard

Validate before calling

if (key == null || key.isEmpty()) { /* skip or return 400 */ }

Type guard

static boolean validAutocompleteKey(@Nullable String key) {
  return key != null && !key.isEmpty();
}

Prevention

When it happens

Trigger: Calling storage.autocompleteTags().getValues(null), or passing a request parameter (e.g. from the Zipkin query API ?key=...) that was never validated before reaching storage.

Common situations: A UI or API client omits the key parameter and framework code forwards null; refactoring that removed an earlier null check; programmatic queries built from maps that may not contain the key.

Related errors


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