{"record":{"id":"494a8a54e292d159","repo":"apache/druid","slug":"must-override-the-binding-for-servertypeconfig-if","errorCode":null,"errorMessage":"Must override the binding for ServerTypeConfig if you want a DruidServerMetadata.","messagePattern":"Must override the binding for ServerTypeConfig if you want a DruidServerMetadata\\.","errorType":"exception","errorClass":"ProvisionException","httpStatus":null,"severity":"critical","filePath":"server/src/main/java/org/apache/druid/guice/StorageNodeModule.java","lineNumber":87,"sourceCode":"    JsonConfigProvider.bind(binder, \"druid.segment.timeline\", SegmentTimelineConfig.class);\n    bindLocationSelectorStrategy(binder);\n    binder.bind(ServerTypeConfig.class).toProvider(Providers.of(null));\n    binder.bind(ColumnConfig.class).to(DruidProcessingConfig.class).in(LazySingleton.class);\n    binder.bind(SegmentCacheManager.class).to(SegmentLocalCacheManager.class).in(LazySingleton.class);\n    binder.bind(VirtualStorageManager.class).to(StorageLocationVirtualStorageManager.class).in(LazySingleton.class);\n    MetricsModule.register(binder, StorageMonitor.class);\n  }\n\n  @Provides\n  @LazySingleton\n  public DruidServerMetadata getMetadata(\n      @Self DruidNode node,\n      @Nullable ServerTypeConfig serverTypeConfig,\n      DruidServerConfig config\n  )\n  {\n    if (serverTypeConfig == null) {\n      throw new ProvisionException(\"Must override the binding for ServerTypeConfig if you want a DruidServerMetadata.\");\n    }\n\n    return new DruidServerMetadata(\n        node.getHostAndPortToUse(),\n        node.getHostAndPort(),\n        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,","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/server/src/main/java/org/apache/druid/guice/StorageNodeModule.java#L69-L105","documentation":"StorageNodeModule.getMetadata builds a DruidServerMetadata for storage nodes (historicals, middle managers) and requires a bound ServerTypeConfig. If the binding is absent (null), provisioning fails with this ProvisionException because the server type is needed to describe the node in the cluster.","triggerScenarios":"Running a node that includes StorageNodeModule without overriding the ServerTypeConfig binding (no ServerType configured, e.g. missing druid.server.type on the node type).","commonSituations":"Custom node types or test harnesses including StorageNodeModule without the ServerTypeConfig override; stripped-down configs for historicals that omit the server type extension.","solutions":["Add a module that binds ServerTypeConfig with the appropriate ServerType (bind(ServerTypeConfig.class).toInstance(new ServerTypeConfig(ServerType.HISTORICAL)))","Ensure the node type's module set (e.g. HistoricalModule) is present, since it installs the binding","In tests, use StorageNodeModule with an override providing ServerTypeConfig"],"exampleFix":"// before\nbinder.install(new StorageNodeModule()); // no ServerTypeConfig\n// after\nbinder.bind(ServerTypeConfig.class).toInstance(new ServerTypeConfig(ServerType.HISTORICAL));\nbinder.install(new StorageNodeModule());","handlingStrategy":"validation","validationCode":"ServerTypeConfig stc = injector.getExistingBinding(Key.get(ServerTypeConfig.class)) == null ? null : injector.getInstance(ServerTypeConfig.class);\nif (stc == null) { throw new IllegalStateException(\"bind ServerTypeConfig before installing StorageNodeModule\"); }","typeGuard":null,"tryCatchPattern":"try {\n  injector.getInstance(DruidServerMetadata.class);\n} catch (ProvisionException e) {\n  if (e.getMessage().contains(\"ServerTypeConfig\")) {\n    log.error(\"Add a module binding ServerTypeConfig for this node type\");\n  }\n  throw e;\n}","preventionTips":["Always install the node-type module (HistoricalModule, etc.) alongside StorageNodeModule","Bind ServerTypeConfig in any custom node module","Add injector-building unit tests for custom node types"],"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"}