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

  1. Use the fully-qualified name of a class implementing com.datastax.driver.core.AuthProvider present on the classpath
  2. Add the jar providing the auth provider to the cassandra-stress classpath (lib/ or -cp)
  3. Use the built-in PlainTextAuthProvider, e.g. -mode native cql3 user=cassandra password=cassandra
  4. 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

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


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)