{"record":{"id":"b7a9fe7b38f90b88","repo":"apache/druid","slug":"can-t-start-b7a9fe","errorCode":null,"errorMessage":"Can't start.","messagePattern":"Can't start\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/db/cache/CoordinatorBasicAuthenticatorCacheNotifier.java","lineNumber":68,"sourceCode":"      AuthenticatorMapper authenticatorMapper,\n      DruidNodeDiscoveryProvider discoveryProvider,\n      @EscalatedClient HttpClient httpClient\n  )\n  {\n    userCacheNotifier = new CommonCacheNotifier(\n        initAuthenticatorConfigMap(authenticatorMapper),\n        discoveryProvider,\n        httpClient,\n        \"/druid-ext/basic-security/authentication/listen/%s\",\n        \"CoordinatorBasicAuthenticatorCacheNotifier\"\n    );\n  }\n\n  @LifecycleStart\n  public void start()\n  {\n    if (!lifecycleLock.canStart()) {\n      throw new ISE(\"Can't start.\");\n    }\n\n    try {\n      userCacheNotifier.start();\n      lifecycleLock.started();\n    }\n    finally {\n      lifecycleLock.exitStart();\n    }\n  }\n\n  @LifecycleStop\n  public void stop()\n  {\n    if (!lifecycleLock.canStop()) {\n      return;\n    }\n    try {","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/druid-basic-security/src/main/java/org/apache/druid/security/basic/authentication/db/cache/CoordinatorBasicAuthenticatorCacheNotifier.java#L50-L86","documentation":"Thrown by CoordinatorBasicAuthenticatorCacheNotifier.start when the lifecycle lock reports the component cannot start. Druid lifecycle components must start exactly once from an idle state; if canStart() returns false the component is already started, starting, or has stopped/failed. The guard converts that illegal lifecycle state into an IllegalStateException.","triggerScenarios":"Calling start() twice on the same instance; calling start() after stop() or after a failed prior start; lifecycle races where two threads invoke start concurrently without the lock granting.","commonSituations":"Manual wiring of the notifier in tests calling start twice; lifecycle ordering mistakes where the component is restarted without being reset; concurrent lifecycle management from multiple threads.","solutions":["Ensure start() is invoked only once per instance and after construction/dependency injection completes","Check lifecycleLock state; if already started, skip the call instead of throwing","Restart the whole lifecycle (or create a new instance) instead of calling start on a stopped component","Use Druid's Lifecycle/LeadershipLatch integration so the framework drives start/stop"],"exampleFix":"// before\nif (!lifecycleLock.canStart()) { throw new ISE(\"Can't start.\"); }\n// after\nif (lifecycleLock.canStart()) { try { userCacheNotifier.start(); lifecycleLock.started(); } catch (Exception e) { lifecycleLock.stop(); throw e; } } // idempotent guard in caller","handlingStrategy":"type-guard","validationCode":"// guard in caller\nboolean startIfIdle(CoordinatorBasicAuthenticatorCacheNotifier n) {\n  try { n.start(); return true; } catch (ISE e) { return false; } // already started/stopped\n}","typeGuard":"boolean isStartable(LifecycleLock lock) { return lock.canStart(); }","tryCatchPattern":"try { notifier.start(); } catch (ISE e) { LOG.info(\"Cache notifier already started or stopped: %s\", e.getMessage()); }","preventionTips":["Call start() exactly once per instance, driven by the Druid Lifecycle","Never restart stopped components; construct a new instance instead","Register lifecycle handlers so the framework manages start ordering","Avoid concurrent manual start calls in tests"],"tags":["lifecycle","illegal-state","basic-security"],"backgroundTag":"invalid-state-transition","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"}