apache/druid · error · IllegalArgumentException
datasource name cannot be null
Error message
datasource name cannot be null
What it means
commitMetadataOnly() in IndexerSQLMetadataStorageCoordinator updates a supervisor's stored metadata (e.g. checkpoint offsets) inside a read-write transaction. Before opening the transaction it validates its arguments and throws IllegalArgumentException when the datasource name is null, because datasource metadata rows are keyed by the datasource and a null key is meaningless. This is a caller-side programming error, not a transient failure.
Source
Thrown at server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java:614
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,
startMetadata,
endMetadata
)View on GitHub (pinned to 9b90983fd2)
Solutions
- Ensure the SupervisorSpec has a non-null dataSource before calling commitMetadataOnly.
- Add a caller-side null/empty check on dataSource and fail fast with a descriptive message.
- Inspect how the spec was deserialized (JSON payload missing 'dataSource') and fix the input payload or deserializer.
Example fix
// before coordinator.commitMetadataOnly(spec.getDataSource(), spec.getId(), startMeta, endMeta); // after String dataSource = Preconditions.checkNotNull(spec.getDataSource(), "dataSource"); coordinator.commitMetadataOnly(dataSource, spec.getId(), startMeta, endMeta);
Defensive patterns
Strategy: validation
Validate before calling
if (dataSource == null || dataSource.isEmpty()) {
throw new IllegalArgumentException("dataSource must be non-null before commitMetadataOnly");
} Type guard
boolean hasDataSource(SupervisorSpec spec) { return spec.getDataSource() != null && !spec.getDataSource().isEmpty(); } Try / catch
try {
coordinator.commitMetadataOnly(dataSource, id, startMeta, endMeta);
} catch (IllegalArgumentException e) {
log.error(e, "Supervisor metadata commit rejected: %s", e.getMessage());
} Prevention
- Always derive the datasource from a validated spec object
- Add unit tests covering specs with missing dataSource fields
- Validate deserialized specs at ingestion boundaries
When it happens
Trigger: Calling commitMetadataOnly(dataSource, supervisorId, startMetadata, endMetadata) with a null first argument — typically when the supervisor spec's dataSource field was never populated or was deserialized as null before the call.
Common situations: A custom supervisor implementation passes a spec whose getDataSource() returns null; external tooling invoking the coordinator directly with a partially constructed spec; unit-test code forgetting to set the datasource on a SupervisorSpec mock.
Related errors
- start metadata cannot be null
- end metadata cannot be null
- supervisorId cannot be null
- Must have a valid, non-null aggregator name
- Must have a valid, non-null aggregator name
AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07).
Data as JSON: /api/errors/2615dda951d4add2.
Report an issue: GitHub.