apache/druid · error · IllegalStateException
Unexpected end of field
Error message
Unexpected end of field
What it means
addStringsToList expects to eventually read the row terminator byte marking the end of the field. If the loop consumes all values without seeing a terminator, the field is truncated relative to its expected layout and "Unexpected end of field" is thrown. Like the overrun check, it protects against corrupt or misaligned frame data.
Solutions
- Re-run the query or re-read the frame from source to replace the truncated data.
- Validate frame offsets/lengths when slicing frame partitions before reading fields.
- Match reader/writer Druid versions and frame format.
Defensive patterns
Strategy: try-catch
Try / catch
try {
reader.readStringsFromMemory(memory, position, limit, list);
} catch (IllegalStateException e) {
if (e.getMessage().equals("Unexpected end of field")) {
throw new CorruptFrameException("Truncated frame field; re-fetch frame", e);
}
throw e;
} Prevention
- Validate partition offsets and lengths when slicing frame files before reading.
- Ensure writers fully flush frames before readers open them.
When it happens
Trigger: Decoding a string field where the declared field region ends (values loop exits) without a ROW_TERMINATOR byte — truncated frames, wrong length passed in, or offset pointing into the middle of a field.
Common situations: Frames sliced/paginated incorrectly before deserialization; reading a frame at a stale or partial offset (e.g. from durable storage that was truncated); version skew in frame serialization.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Invalid value start byte
- Value overrun
- A-Not-B requires at least 1 sketch
- Access-Check-Result
- Action [ ] failed for worker [ ] with status ( )
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/f6bece0b4f0225d5.
Report an issue: GitHub.
Appendix: source
Thrown at processing/src/main/java/org/apache/druid/frame/field/StringFieldReader.java:604
final ByteBuffer buf = FrameReaderUtils.readByteBuffer(memory, position, len);
list.add(buf);
position += len;
break;
}
}
break;
default:
throw new ISE("Invalid value start byte [%s]", kind);
}
}
if (!rowTerminatorSeen) {
throw new ISE("Unexpected end of field");
}
return isEffectivelyNull;
}
}
View on GitHub (pinned to 9b90983fd2)