apache/druid · error · IllegalArgumentException

supervisorId cannot be null

Error message

supervisorId cannot be null

What it means

IndexerSQLMetadataStorageCoordinator.commitMetadataOnly validates its arguments before writing supervisor metadata: supervisorId, dataSource, startMetadata (and subsequently endMetadata) must all be non-null. A null supervisorId throws IllegalArgumentException('supervisorId cannot be null').

Source

Thrown at server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:611

        appendSegmentToReplaceLock,
        supervisorId,
        startMetadata,
        endMetadata,
        taskAllocatorId,
        segmentSchemaMapping
    );
  }

  @Override
  public SegmentPublishResult commitMetadataOnly(
      String supervisorId,
      String dataSource,
      DataSourceMetadata startMetadata,
      DataSourceMetadata endMetadata
  )
  {
    if (supervisorId == null) {
      throw new IllegalArgumentException("supervisorId cannot be null");
    }
    if (dataSource == null) {
      throw new IllegalArgumentException("datasource name cannot be null");
    }
    if (startMetadata == null) {
      throw new IllegalArgumentException("start metadata cannot be null");
    }
    if (endMetadata == null) {
      throw new IllegalArgumentException("end metadata cannot be null");
    }

    try {
      return inReadWriteDatasourceTransaction(
          dataSource,
          transaction -> updateDataSourceMetadataInTransaction(
              transaction,
              supervisorId,
              dataSource,

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Ensure the supervisor is created/registered so its supervisorId is populated before calling commitMetadataOnly
  2. Add a null check that skips or defers the metadata commit when supervisorId is absent
  3. Persist and reload the supervisorId from state store rather than passing a transient null

Example fix

// before
coordinator.commitMetadataOnly(supervisor.getId(), startMetadata, endMetadata); // getId() may be null
// after
String supervisorId = supervisor.getId();
if (supervisorId != null) {
  coordinator.commitMetadataOnly(supervisorId, startMetadata, endMetadata);
}
Defensive patterns

Strategy: validation

Validate before calling

if (supervisorId == null || dataSource == null || startMetadata == null || endMetadata == null) { throw new IllegalArgumentException("commitMetadataOnly requires non-null supervisorId, dataSource, startMetadata, endMetadata"); }

Type guard

boolean ready = supervisorId != null && dataSource != null && startMetadata != null && endMetadata != null;

Try / catch

try { coordinator.commitMetadataOnly(supervisorId, start, end); } catch (IllegalArgumentException e) { if (e.getMessage().contains("supervisorId cannot be null")) { log.warn("Supervisor not yet initialized; deferring metadata commit"); return; } throw e; }

Prevention

When it happens

Trigger: Calling commitMetadataOnly with a null supervisorId — e.g. a supervisor that has not yet been assigned an id, or reset/merge code invoking commit before supervisor creation completes.

Common situations: Custom supervisor implementations calling commitMetadataOnly during early initialization before the id is generated; restoring metadata from incomplete state where supervisorId was never persisted.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/a7d2a170aa9884dc. Report an issue: GitHub.