{"record":{"id":"839480db3559f082","repo":"apache/cassandra","slug":"there-was-an-attempt-to-load-custom-startup-checks","errorCode":null,"errorMessage":"There was an attempt to load custom startup checks with same name which is ambiguous: ${duplicitNames}","messagePattern":"There was an attempt to load custom startup checks with same name which is ambiguous: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StartupChecks.java","lineNumber":188,"sourceCode":"        try\n        {\n            for (StartupCheck check : ServiceLoader.load(StartupCheck.class))\n            {\n                if (!uniqueNames.add(check.name()))\n                    duplicitNames.add(check.name());\n                else\n                    customChecks.add(check);\n            }\n        }\n        catch (ServiceConfigurationError t)\n        {\n            throw new ConfigurationException(\"Unable to get startup checks via ServiceLoader. \" +\n                                             \"Custom checks will not be triggered.\", t);\n        }\n\n        if (!duplicitNames.isEmpty())\n        {\n            throw new IllegalStateException(\"There was an attempt to load custom startup \" +\n                                            \"checks with same name which is ambiguous: \" + duplicitNames);\n        }\n\n        for (StartupCheck customCheck : customChecks)\n        {\n            for (StartupCheck preFlightCheck : preFlightChecks)\n            {\n                if (preFlightCheck.name().equals(customCheck.name()))\n                {\n                    throw new IllegalStateException(\"There was an attempt to load custom startup check \" +\n                                                    \"with same name as in-built check: \" + preFlightCheck.name());\n                }\n            }\n        }\n\n        preFlightChecks.addAll(customChecks);\n\n        return this;","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StartupChecks.java#L170-L206","documentation":"Two or more custom startup checks discovered via ServiceLoader declare the same name() value, which makes check identification ambiguous. Cassandra rejects the configuration with an IllegalStateException rather than silently running duplicate/ambiguous checks.","triggerScenarios":"getCustomStartupChecks collects custom checks and two distinct ServiceLoader-provided StartupCheck classes return identical strings from name(), populating duplicitNames.","commonSituations":"Deploying two different jars that both register a custom check with the same name, copying a custom check and forgetting to rename it, multiple builds of the same provider jar on the classpath.","solutions":["Rename the name() returned by one of the conflicting custom checks","Remove the duplicate provider jar or META-INF/services entry from the classpath","Check the message for the list of duplicated names to find the offenders"],"exampleFix":"// before\npublic String name() { return \"disk-check\"; }\n// after (second provider)\npublic String name() { return \"vendorx-disk-check\"; }","handlingStrategy":"validation","validationCode":"grep name() returns across all custom check jars and assert uniqueness before deploy","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefix custom check names with a vendor namespace","Audit lib/ for duplicate provider jars","Document check names in an internal registry"],"tags":["startup","serviceloader","duplicate-name"],"backgroundTag":"conflicting-config-options","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}