openzipkin/zipkin · error · IOException

End of input while parsing object.

Error message

End of input while parsing object.

What it means

While iterating a span object's fields with parser.nextValue(), a null token means the input ended before the closing '}' — truncated JSON. The parser throws IOException('End of input while parsing object.') rather than silently returning a half-built span, so incomplete data never masquerades as a valid span.

Source

Thrown at zipkin-storage/elasticsearch/src/main/java/zipkin2/elasticsearch/internal/JsonSerializers.java:53

  public interface ObjectParser<T> {
    T parse(JsonParser jsonParser) throws IOException;
  }

  public static final ObjectParser<Span> SPAN_PARSER = JsonSerializers::parseSpan;

  static Span parseSpan(JsonParser parser) throws IOException {
    if (!parser.isExpectedStartObjectToken()) {
      throw new IllegalArgumentException("Not a valid JSON object, start token: " +
        parser.currentToken());
    }

    Span.Builder result = Span.newBuilder();

    JsonToken value;
    while ((value = parser.nextValue()) != JsonToken.END_OBJECT) {
      if (value == null) {
        throw new IOException("End of input while parsing object.");
      }
      if (value == JsonToken.VALUE_NULL) {
        continue;
      }
      switch (parser.currentName()) {
        case "traceId":
          result.traceId(parser.getText());
          break;
        case "parentId":
          result.parentId(parser.getText());
          break;
        case "id":
          result.id(parser.getText());
          break;
        case "kind":
          result.kind(Span.Kind.valueOf(parser.getText()));
          break;
        case "name":

View on GitHub (pinned to 878ce2a1fa)

Solutions

  1. Validate the JSON is complete before parsing (matching braces / json.Parse up front, or lenient read of full content first).
  2. Fix the transport producing truncation (proxy buffer limits, message framing).
  3. Regenerate or repair the malformed fixtures/records at their source.

Example fix

// before
String json = "{\"traceId\":\"abc\"";  // missing '}'
SPAN_PARSER.parse(factory.createParser(json)); // IOException: End of input while parsing object.

// after
String json = "{\"traceId\":\"abc\",\"id\":\"def\"}";
Span span = SPAN_PARSER.parse(factory.createParser(json));
Defensive patterns

Strategy: validation

Validate before calling

// ensure the document is complete JSON before handing it to the span parser
var node = objectMapper.readTree(spanJson); // throws on truncated input with a clear error
if (node == null || !node.isObject()) throw new IOException("Incomplete span payload");

Try / catch

try {
  Span span = SPAN_PARSER.parse(factory.createParser(json));
} catch (IOException e) {
  if ("End of input while parsing object.".equals(e.getMessage())) {
    // truncated record: log, drop, and alert on the transport doing the truncation
  }
}

Prevention

When it happens

Trigger: Feeding SPAN_PARSER a truncated document such as {"traceId":"abc" (no closing brace); streaming spans from a source that cuts off mid-record; decompression or transfer truncating Elasticsearch response bodies.

Common situations: Reading span JSON from files/message queues where records were split; HTTP responses truncated by proxies with response-size limits; hand-built test fixtures missing braces.

Related errors


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