apache/cassandra · error · IllegalArgumentException
Invalid auth provider class:
Error message
Invalid auth provider class:
What it means
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.
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
Example fix
// before -mode native cql3 -auth-provider com.dse.auth.DseAuthProvider // after -mode native cql3 user=cassandra password=cassandra
Defensive patterns
Strategy: try-catch
Validate before calling
Class<?> c;
try { c = Class.forName(authProviderClassName); }
catch (ClassNotFoundException e) { fail("auth provider not on classpath: " + authProviderClassName); }
if (!AuthProvider.class.isAssignableFrom(c)) fail("must implement AuthProvider"); Type guard
boolean isValidAuthProvider(String name) {
try { return Class.forName(name).getConstructors().length > 0 && AuthProvider.class.isAssignableFrom(Class.forName(name)); }
catch (Throwable t) { return false; }
} Try / catch
try { SettingsMode.get(clArgs); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Invalid auth provider class")) { log(e.getCause()); usePlainTextAuth(); } else throw e; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- create method not found
- Error occured when setting the config for setter
- Unable to create instance of IAuditLogger.
- Unable to find class
- Abbreviated subcommands are not allowed.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/cc20a5ae5fb6c310.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/SettingsMode.java:111
try
{
Class<? extends AuthProvider> clazz =
FBUtilities.classForNameWithoutInitialization(authProviderClassname,
"auth provider",
AuthProvider.class);
// check we can instantiate it
if (PlainTextAuthProvider.class.equals(clazz))
{
authProvider = (AuthProvider) clazz.getConstructor(String.class, String.class).newInstance(username, password);
}
else
{
authProvider = (AuthProvider) clazz.newInstance();
}
}
catch (Exception e)
{
throw new IllegalArgumentException("Invalid auth provider class: " + opts.authProvider.value(), e);
}
}
else
{
authProvider = null;
}
}
}
public ProtocolOptions.Compression compression()
{
return ProtocolOptions.Compression.valueOf(compression);
}
private static class Cql3Options extends GroupedOptions
{
final OptionSimple protocolVersion = new OptionSimple("protocolVersion=", "[2-5]+", "NEWEST_SUPPORTED", "CQL Protocol Version", false);
final OptionSimple usePrepared = new OptionSimple("prepared", "", null, "Use prepared statements", false);View on GitHub (pinned to 88fd0f6a0e)