{"record":{"id":"842fc4833c7b2df2","repo":"apache/iceberg","slug":"cannot-initialize-authmanager-s-does-not-impleme","errorCode":null,"errorMessage":"Cannot initialize AuthManager, %s does not implement AuthManager","messagePattern":"Cannot initialize AuthManager, (.+?) does not implement AuthManager","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java","lineNumber":128,"sourceCode":"    try {\n      ctor =\n          DynConstructors.builder(AuthManager.class)\n              .loader(AuthManagers.class.getClassLoader())\n              .impl(impl, String.class) // with name\n              .impl(impl, String.class, AuthManager.class) // with name and delegate\n              .buildChecked();\n    } catch (NoSuchMethodException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot initialize AuthManager implementation %s: %s\", impl, e.getMessage()),\n          e);\n    }\n\n    AuthManager authManager;\n    try {\n      authManager = ctor.newInstance(name, delegate);\n    } catch (ClassCastException e) {\n      throw new IllegalArgumentException(\n          String.format(\"Cannot initialize AuthManager, %s does not implement AuthManager\", impl),\n          e);\n    }\n\n    return authManager;\n  }\n}\n","sourceCodeStart":110,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/auth/AuthManagers.java#L110-L136","documentation":"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.","triggerScenarios":"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.","commonSituations":"Using a class written against an older Iceberg auth SPI; copying an impl class from another library; renaming/refactoring removed the interface implementation.","solutions":["Make the class implement org.apache.iceberg.rest.auth.AuthManager","Verify against the AuthManager interface in the Iceberg version in use (interface moved/changed across versions)","Check for duplicate/older iceberg-core jars shadowing the AuthManager interface (different classloader)","Use a built-in auth manager type instead of a custom impl"],"exampleFix":"// before\nclass MyAuth extends OAuth2Properties { ... }\n// after\nclass MyAuth implements AuthManager {\n  public MyAuth(String name) { ... }\n  public AuthSession session(Map<String,String> properties) { ... }\n}","handlingStrategy":"validation","validationCode":"Class<?> cls = Class.forName(implClassName);\nboolean implementsAuthManager = AuthManager.class.isAssignableFrom(cls);","typeGuard":"boolean implementsAuthManager(String impl) {\n  try { return AuthManager.class.isAssignableFrom(Class.forName(impl)); }\n  catch (ClassNotFoundException e) { return false; }\n}","tryCatchPattern":"try { authManager = AuthManagers.loadAuthManager(config); } catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"does not implement AuthManager\")) { /* implement the interface */ }\n  else throw e;\n}","preventionTips":["Always implement org.apache.iceberg.rest.auth.AuthManager in custom auth classes","Check for duplicate iceberg jars causing classloader/interface identity mismatch","Verify against the interface in your exact Iceberg version"],"tags":["auth","type-mismatch","reflection","rest-catalog"],"backgroundTag":"type-mismatch","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}