apache/druid · error · IllegalArgumentException

Cannot convert to Long offset

Error message

Cannot convert  to Long offset

What it means

RabbitStreamSupervisor.createSequenceOffsetFromObject received a stored offset object that is neither a Number nor a numeric String, so it cannot be coerced to the Long sequence offset RabbitMQ streams use. This usually means persisted supervisor/segment metadata contains offsets written by a different supplier type or corrupted state.

Solutions

  1. Log/examine the offending offsetObj type to identify where the bad value came from.
  2. Check persisted supervisor metadata (offsets in metadata store) for corruption or mismatched supplier types.
  3. If migrating from another stream supplier (e.g. Kafka), reset offsets or start fresh for the RabbitMQ stream.
  4. Wrap Long.parseLong failures distinctly so numeric-string errors are reported separately from non-numeric types.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at extensions-contrib/rabbit-stream-indexing-service/src/main/java/org/apache/druid/indexing/rabbitstream/supervisor/RabbitStreamSupervisor.java:396 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/104e2f76c1773647. Report an issue: GitHub.

Appendix: source

Thrown at extensions-contrib/rabbit-stream-indexing-service/src/main/java/org/apache/druid/indexing/rabbitstream/supervisor/RabbitStreamSupervisor.java:396

  @Override
  protected String createPartitionIdFromString(String partitionIdString)
  {
    // RabbitMQ uses String as partition ID, so just return the string as-is
    return partitionIdString;
  }

  @Override
  protected Long createSequenceOffsetFromObject(Object offsetObj)
  {
    // RabbitMQ uses Long as sequence offset
    if (offsetObj instanceof Number) {
      return ((Number) offsetObj).longValue();
    }
    if (offsetObj instanceof String) {
      return Long.parseLong((String) offsetObj);
    }
    throw new IllegalArgumentException("Cannot convert " + offsetObj.getClass() + " to Long offset");
  }

  @Override
  public LagStats computeLagStats()
  {
    Map<String, Long> partitionRecordLag = getPartitionRecordLag();
    if (partitionRecordLag == null) {
      return new LagStats(0, 0, 0);
    }

    return aggregatePartitionLags(partitionRecordLag);
  }

  @Override
  public void updatePartitionLagFromStream()
  {
    getRecordSupplierLock().lock();

View on GitHub (pinned to 9b90983fd2)