{"record":{"id":"ff3eab5cc2779212","repo":"apache/druid","slug":"must-override-the-binding-for-servertypeconfig-if-ff3eab","errorCode":null,"errorMessage":"Must override the binding for ServerTypeConfig if you want a DataNodeService.","messagePattern":"Must override the binding for ServerTypeConfig if you want a DataNodeService\\.","errorType":"exception","errorClass":"ProvisionException","httpStatus":null,"severity":"critical","filePath":"server/src/main/java/org/apache/druid/guice/StorageNodeModule.java","lineNumber":111,"sourceCode":"        node.getHostAndTlsPort(),\n        config.getMaxSize(),\n        config.getStorageSize(),\n        serverTypeConfig.getServerType(),\n        config.getTier(),\n        config.getPriority()\n    );\n  }\n\n  @Provides\n  @LazySingleton\n  public DataNodeService getDataNodeService(\n      @Nullable ServerTypeConfig serverTypeConfig,\n      DruidServerConfig config,\n      @Named(IS_SEGMENT_CACHE_CONFIGURED) Boolean isSegmentCacheConfigured\n  )\n  {\n    if (serverTypeConfig == null) {\n      throw new ProvisionException(\"Must override the binding for ServerTypeConfig if you want a DataNodeService.\");\n    }\n    if (!isSegmentCacheConfigured) {\n      log.info(\n          \"Segment cache not configured on ServerType [%s]. It will not be assignable for segment placement\",\n          serverTypeConfig.getServerType()\n      );\n      if (ServerType.HISTORICAL.equals(serverTypeConfig.getServerType())) {\n        throw new ProvisionException(\"druid.segmentCache.locations must be set on historicals.\");\n      }\n    }\n\n    return new DataNodeService(\n        config.getTier(),\n        config.getMaxSize(),\n        config.getStorageSize(),\n        serverTypeConfig.getServerType(),\n        config.getPriority(),\n        isSegmentCacheConfigured","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/guice/StorageNodeModule.java#L93-L129","documentation":"StorageNodeModule.getDataNodeService creates the DataNodeService advertised to the cluster and requires a bound ServerTypeConfig; if it is null, provisioning fails with this ProvisionException. Without the server type the node cannot describe its data-serving role.","triggerScenarios":"Provisioning DataNodeService on a storage node where ServerTypeConfig was not overridden/bound; same root cause as the DruidServerMetadata check but hit when building the service.","commonSituations":"Custom/derived node types missing the ServerTypeConfig binding; minimal test setups including StorageNodeModule directly without overrides.","solutions":["Bind ServerTypeConfig in a module override for the node type","Use the standard node-type module (e.g. HistoricalModule) which supplies the binding","Set the node type correctly so the appropriate ServerTypeConfig extension module is loaded"],"exampleFix":"// before\nnew StorageNodeModule() // DataNodeService provision fails\n// after\nbinder.bind(ServerTypeConfig.class).toInstance(new ServerTypeConfig(ServerType.HISTORICAL));","handlingStrategy":"validation","validationCode":"if (injector.getExistingBinding(Key.get(ServerTypeConfig.class)) == null) {\n  throw new IllegalStateException(\"ServerTypeConfig binding required for DataNodeService\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  injector.getInstance(DataNodeService.class);\n} catch (ProvisionException e) {\n  if (e.getMessage().contains(\"ServerTypeConfig\")) {\n    log.error(\"Bind ServerTypeConfig in the node's module set\");\n  }\n  throw e;\n}","preventionTips":["Reuse standard node-type modules that supply ServerTypeConfig","Cover custom node types with injector bootstrap tests","Never install StorageNodeModule bare in tests without an override"],"tags":["dependency-injection","configuration","startup"],"backgroundTag":"missing-required-config","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}