apache/iceberg · error · IllegalArgumentException

Cannot initialize AuthManager

Error message

Cannot initialize AuthManager, %s does not implement AuthManager

What it means

Thrown when the reflectively constructed auth manager instance is not an instance of AuthManager (ClassCastException on newInstance). The loaded class exists and has a usable constructor but does not implement the AuthManager interface.

Solutions

  1. Make the class implement org.apache.iceberg.rest.auth.AuthManager
  2. Verify against the AuthManager interface in the Iceberg version in use (interface moved/changed across versions)
  3. Check for duplicate/older iceberg-core jars shadowing the AuthManager interface (different classloader)
  4. Use a built-in auth manager type instead of a custom impl

Example fix

// before
class MyAuth extends OAuth2Properties { ... }
// after
class MyAuth implements AuthManager {
  public MyAuth(String name) { ... }
  public AuthSession session(Map<String,String> properties) { ... }
}
Defensive patterns

Strategy: validation

Validate before calling

Class<?> cls = Class.forName(implClassName);
boolean implementsAuthManager = AuthManager.class.isAssignableFrom(cls);

Type guard

boolean implementsAuthManager(String impl) {
  try { return AuthManager.class.isAssignableFrom(Class.forName(impl)); }
  catch (ClassNotFoundException e) { return false; }
}

Try / catch

try { authManager = AuthManagers.loadAuthManager(config); } catch (IllegalArgumentException e) {
  if (e.getMessage().contains("does not implement AuthManager")) { /* implement the interface */ }
  else throw e;
}

Prevention

When it happens

Trigger: Configuring rest.auth.type to an impl class that implements some other interface (e.g. an old/deprecated auth interface or a foreign SPI) instead of org.apache.iceberg.rest.auth.AuthManager.

Common situations: Using a class written against an older Iceberg auth SPI; copying an impl class from another library; renaming/refactoring removed the interface implementation.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/842fc4833c7b2df2. Report an issue: GitHub.

Appendix: source

Thrown at core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java:128

    try {
      ctor =
          DynConstructors.builder(AuthManager.class)
              .loader(AuthManagers.class.getClassLoader())
              .impl(impl, String.class) // with name
              .impl(impl, String.class, AuthManager.class) // with name and delegate
              .buildChecked();
    } catch (NoSuchMethodException e) {
      throw new IllegalArgumentException(
          String.format(
              "Cannot initialize AuthManager implementation %s: %s", impl, e.getMessage()),
          e);
    }

    AuthManager authManager;
    try {
      authManager = ctor.newInstance(name, delegate);
    } catch (ClassCastException e) {
      throw new IllegalArgumentException(
          String.format("Cannot initialize AuthManager, %s does not implement AuthManager", impl),
          e);
    }

    return authManager;
  }
}

View on GitHub (pinned to 86d9c8fc54)