{"record":{"id":"cc20a5ae5fb6c310","repo":"apache/cassandra","slug":"invalid-auth-provider-class","errorCode":null,"errorMessage":"Invalid auth provider class: ","messagePattern":"Invalid auth provider class: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/SettingsMode.java","lineNumber":111,"sourceCode":"                try\n                {\n                    Class<? extends AuthProvider> clazz =\n                        FBUtilities.classForNameWithoutInitialization(authProviderClassname,\n                                                                      \"auth provider\",\n                                                                      AuthProvider.class);\n                    // check we can instantiate it\n                    if (PlainTextAuthProvider.class.equals(clazz))\n                    {\n                        authProvider = (AuthProvider) clazz.getConstructor(String.class, String.class).newInstance(username, password);\n                    }\n                    else\n                    {\n                        authProvider = (AuthProvider) clazz.newInstance();\n                    }\n                }\n                catch (Exception e)\n                {\n                    throw new IllegalArgumentException(\"Invalid auth provider class: \" + opts.authProvider.value(), e);\n                }\n            }\n            else\n            {\n                authProvider = null;\n            }\n        }\n    }\n\n    public ProtocolOptions.Compression compression()\n    {\n        return ProtocolOptions.Compression.valueOf(compression);\n    }\n\n    private static class Cql3Options extends GroupedOptions\n    {\n        final OptionSimple protocolVersion = new OptionSimple(\"protocolVersion=\", \"[2-5]+\", \"NEWEST_SUPPORTED\", \"CQL Protocol Version\", false);\n        final OptionSimple usePrepared = new OptionSimple(\"prepared\", \"\", null, \"Use prepared statements\", false);","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/SettingsMode.java#L93-L129","documentation":"When -mode is given an auth provider class name, SettingsMode reflectively loads and instantiates the class; any failure (class not found, wrong type, constructor exception) is rethrown as IllegalArgumentException 'Invalid auth provider class: <name>' with the cause chained.","triggerScenarios":"cassandra-stress -mode native<cql3> with -auth-provider containing a class name that is not on the classpath, does not implement com.datastax.driver.core.AuthProvider, or throws in its constructor.","commonSituations":"Using DseAuthProvider or a plugin class that only exists in DSE, misspelled fully-qualified class name, missing jar on the stress tool classpath, driver version where the AuthProvider interface moved.","solutions":["Use the fully-qualified name of a class implementing com.datastax.driver.core.AuthProvider present on the classpath","Add the jar providing the auth provider to the cassandra-stress classpath (lib/ or -cp)","Use the built-in PlainTextAuthProvider, e.g. -mode native cql3 user=cassandra password=cassandra","Check the chained cause exception ('Caused by') for the real load/instantiation failure"],"exampleFix":"// before\n-mode native cql3 -auth-provider com.dse.auth.DseAuthProvider\n// after\n-mode native cql3 user=cassandra password=cassandra","handlingStrategy":"try-catch","validationCode":"Class<?> c;\ntry { c = Class.forName(authProviderClassName); }\ncatch (ClassNotFoundException e) { fail(\"auth provider not on classpath: \" + authProviderClassName); }\nif (!AuthProvider.class.isAssignableFrom(c)) fail(\"must implement AuthProvider\");","typeGuard":"boolean isValidAuthProvider(String name) {\n  try { return Class.forName(name).getConstructors().length > 0 && AuthProvider.class.isAssignableFrom(Class.forName(name)); }\n  catch (Throwable t) { return false; }\n}","tryCatchPattern":"try { SettingsMode.get(clArgs); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Invalid auth provider class\")) { log(e.getCause()); usePlainTextAuth(); } else throw e; }","preventionTips":["Always use fully-qualified class names","Confirm the provider jar is on the stress classpath","Prefer built-in PlainTextAuthProvider unless a custom provider is required","Check the 'Caused by' chain to distinguish missing class vs constructor failure"],"tags":["classpath","reflection","authentication","cli"],"backgroundTag":"class-not-found","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"}