openzipkin/zipkin · error · IllegalArgumentException

No key at {}

Error message

No key at {}

What it means

In V1 JSON spans, every binary annotation object must have a 'key' member. After parsing the object, V1JsonSpanReader throws 'No key at <jsonPath>' when key == null — value or endpoint may be absent, but key is mandatory because binary annotations are a key/value map representation.

Source

Thrown at zipkin/src/main/java/zipkin2/internal/V1JsonSpanReader.java:149

      if (nextName.equals("key")) {
        key = reader.nextString();
      } else if (nextName.equals("value")) {
        if (reader.peekString()) {
          stringValue = reader.nextString();
        } else if (reader.peekBoolean()) {
          booleanValue = reader.nextBoolean();
        } else {
          reader.skipValue();
        }
      } else if (nextName.equals("endpoint")) {
        endpoint = ENDPOINT_READER.fromJson(reader);
      } else {
        reader.skipValue();
      }
    }

    if (key == null) {
      throw new IllegalArgumentException("No key at " + reader.getPath());
    }
    reader.endObject();

    if (stringValue != null) {
      builder.addBinaryAnnotation(key, stringValue, endpoint);
    } else if (booleanValue != null && booleanValue && endpoint != null) {
      if (key.equals("sa") || key.equals("ca") || key.equals("ma")) {
        builder.addBinaryAnnotation(key, endpoint);
      }
    }
  }
}

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Add the missing "key" member to the binary annotation at the reported path.
  2. Regenerate V1 fixtures from real spans: Span.Builder.putTag then JSON_V1 encode.
  3. Migrate producers to V2 JSON where tags are a plain object of name->string, harder to malform.
  4. Validate legacy payloads with a JSON schema before decode.

Example fix

// before
{"binaryAnnotations":[{"value":"i-9b4f2a","endpoint":{"serviceName":"web"}}]}

// after
{"binaryAnnotations":[{"key":"ec2.instance-id","value":"i-9b4f2a","endpoint":{"serviceName":"web"}}]}
Defensive patterns

Strategy: validation

Validate before calling

boolean hasV1BinaryAnnotationKey(JsonNode n) { return n.hasNonNull("key"); }

Prevention

When it happens

Trigger: Decoding JSON_V1 input whose binaryAnnotations[] entry omits 'key', e.g. {"value":"zipkin","endpoint":{...}}.

Common situations: Legacy fixture files hand-edited incorrectly; converters from other formats mapping tag values but not names; JSON pipelines renaming/dropping the key field.

Related errors


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