{"record":{"id":"a7d2a170aa9884dc","repo":"apache/druid","slug":"supervisorid-cannot-be-null","errorCode":null,"errorMessage":"supervisorId cannot be null","messagePattern":"supervisorId cannot be null","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java","lineNumber":611,"sourceCode":"        appendSegmentToReplaceLock,\n        supervisorId,\n        startMetadata,\n        endMetadata,\n        taskAllocatorId,\n        segmentSchemaMapping\n    );\n  }\n\n  @Override\n  public SegmentPublishResult commitMetadataOnly(\n      String supervisorId,\n      String dataSource,\n      DataSourceMetadata startMetadata,\n      DataSourceMetadata endMetadata\n  )\n  {\n    if (supervisorId == null) {\n      throw new IllegalArgumentException(\"supervisorId cannot be null\");\n    }\n    if (dataSource == null) {\n      throw new IllegalArgumentException(\"datasource name cannot be null\");\n    }\n    if (startMetadata == null) {\n      throw new IllegalArgumentException(\"start metadata cannot be null\");\n    }\n    if (endMetadata == null) {\n      throw new IllegalArgumentException(\"end metadata cannot be null\");\n    }\n\n    try {\n      return inReadWriteDatasourceTransaction(\n          dataSource,\n          transaction -> updateDataSourceMetadataInTransaction(\n              transaction,\n              supervisorId,\n              dataSource,","sourceCodeStart":593,"sourceCodeEnd":629,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/metadata/IndexerSQLMetadataStorageCoordinator.java#L593-L629","documentation":"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').","triggerScenarios":"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.","commonSituations":"Custom supervisor implementations calling commitMetadataOnly during early initialization before the id is generated; restoring metadata from incomplete state where supervisorId was never persisted.","solutions":["Ensure the supervisor is created/registered so its supervisorId is populated before calling commitMetadataOnly","Add a null check that skips or defers the metadata commit when supervisorId is absent","Persist and reload the supervisorId from state store rather than passing a transient null"],"exampleFix":"// before\ncoordinator.commitMetadataOnly(supervisor.getId(), startMetadata, endMetadata); // getId() may be null\n// after\nString supervisorId = supervisor.getId();\nif (supervisorId != null) {\n  coordinator.commitMetadataOnly(supervisorId, startMetadata, endMetadata);\n}","handlingStrategy":"validation","validationCode":"if (supervisorId == null || dataSource == null || startMetadata == null || endMetadata == null) { throw new IllegalArgumentException(\"commitMetadataOnly requires non-null supervisorId, dataSource, startMetadata, endMetadata\"); }","typeGuard":"boolean ready = supervisorId != null && dataSource != null && startMetadata != null && endMetadata != null;","tryCatchPattern":"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; }","preventionTips":["Only call commitMetadataOnly after the supervisor has an assigned id","Null-check all four arguments at the call site","Initialize supervisor state fully before metadata operations"],"tags":["java","metadata","supervisor","null-check"],"backgroundTag":"missing-required-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}