apache/druid · error · IllegalArgumentException
Index[ ] < 0
Error message
Index[%s] < 0
What it means
checkIndex() is a validation guard invoked by get() before any buffer access. It rejects a negative element index up front so callers get the same IAE (and message) that the legacy V1 GenericIndexed produced, instead of a confusing buffer underflow later. The faulty input is the index argument passed to get().
Solutions
- Check the caller that produced the index; a negative index indicates an upstream computation or offset bug
- Validate indexes before calling get() when index values come from external input
- If the negative index originates from internally stored offsets, report it as a possible segment-corruption or indexing bug
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramIndexed.java:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/92a8301028422185.
Report an issue: GitHub.
Appendix: source
Thrown at extensions-contrib/spectator-histogram/src/main/java/org/apache/druid/spectator/histogram/SpectatorHistogramIndexed.java:102
offsetsHeader = NullableOffsetsHeader.read(buffer);
// Size is count of entries
size = offsetsHeader.size();
// The rest of the buffer is the values
valueBuffer = buffer.slice();
}
/**
* Checks if {@code index} a valid `element index` in SpectatorHistogramIndexed.
* Similar to Preconditions.checkElementIndex() except this method throws {@link IAE} with custom error message.
* <p>
* Used here to get existing behavior(same error message and exception) of V1 GenericIndexed.
*
* @param index index identifying an element of an SpectatorHistogramIndexed.
*/
private void checkIndex(int index)
{
if (index < 0) {
throw new IAE("Index[%s] < 0", index);
}
if (index >= size) {
throw new IAE("Index[%d] >= size[%d]", index, size);
}
}
public Class<? extends SpectatorHistogram> getClazz()
{
return strategy.getClazz();
}
@Override
public int size()
{
return size;
}
@NullableView on GitHub (pinned to 9b90983fd2)