{"record":{"id":"84e8d8db4f864fbb","repo":"apache/iceberg","slug":"cannot-initialize-tlsconfigurer-s-does-not-imple","errorCode":null,"errorMessage":"Cannot initialize TLSConfigurer, %s does not implement TLSConfigurer.","messagePattern":"Cannot initialize TLSConfigurer, (.+?) does not implement TLSConfigurer\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/rest/HTTPClient.java","lineNumber":462,"sourceCode":"    DynConstructors.Ctor<TLSConfigurer> ctor;\n    try {\n      ctor =\n          DynConstructors.builder(TLSConfigurer.class)\n              .loader(HTTPClient.class.getClassLoader())\n              .impl(impl)\n              .buildChecked();\n    } catch (NoSuchMethodException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot initialize TLSConfigurer implementation %s: %s\", impl, e.getMessage()),\n          e);\n    }\n\n    TLSConfigurer configurer;\n    try {\n      configurer = ctor.newInstance();\n    } catch (ClassCastException e) {\n      throw new IllegalArgumentException(\n          String.format(\n              \"Cannot initialize TLSConfigurer, %s does not implement TLSConfigurer.\", impl),\n          e);\n    }\n\n    configurer.initialize(properties);\n\n    return configurer;\n  }\n\n  @VisibleForTesting\n  static ConnectionConfig configureConnectionConfig(Map<String, String> properties) {\n    Long connectionTimeoutMillis =\n        PropertyUtil.propertyAsNullableLong(properties, REST_CONNECTION_TIMEOUT_MS);\n    Integer socketTimeoutMillis =\n        PropertyUtil.propertyAsNullableInt(properties, REST_SOCKET_TIMEOUT_MS);\n\n    if (connectionTimeoutMillis == null && socketTimeoutMillis == null) {","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/rest/HTTPClient.java#L444-L480","documentation":"HTTPClient instantiates the configured TLS implementation reflectively; if ctor.newInstance() returns an object that is not a TLSConfigurer, the ClassCastException is converted into an IllegalArgumentException with this message. The configured class exists and is constructible but does not implement the required interface.","triggerScenarios":"Setting the TLS implementation config property to a class that exists and has a no-arg constructor but does not implement org.apache.iceberg.rest.auth.TLSConfigurer — e.g. a random SSLContext factory or a class from a different library.","commonSituations":"Copying config from another framework (e.g. pointing at a generic SSLSocketFactory class); refactoring renamed/moved the interface so the class no longer implements TLSConfigurer; wrong class picked from an autocomplete list.","solutions":["Make the configured class implement TLSConfigurer (and keep the public no-arg constructor).","Set the config property to a genuine TLSConfigurer implementation class.","Check the package of the interface your class implements — a similarly named interface from another library does not count.","Upgrade/downgrade so client and implementation agree on the TLSConfigurer interface version."],"exampleFix":"// before: wrong interface\nclass MyTls extends CustomSslFactory {}\n// after\npublic class MyTls implements org.apache.iceberg.rest.auth.TLSConfigurer {\n  public MyTls() {}\n  public void initialize(Map<String, String> properties) { ... }\n}","handlingStrategy":"validation","validationCode":"Class<?> c = Class.forName(implClassName);\nif (!TLSConfigurer.class.isAssignableFrom(c)) {\n  throw new IllegalArgumentException(implClassName + \" does not implement TLSConfigurer\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  buildClient();\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().contains(\"does not implement TLSConfigurer\")) {\n    // correct the configured class or fall back to the default TLS configurer\n  }\n  throw e;\n}","preventionTips":["Implement the exact org.apache.iceberg.rest.auth.TLSConfigurer interface.","Verify the configured class after refactors that move or rename interfaces.","Do not reuse class names from other frameworks' TLS configuration."],"tags":["configuration","reflection","tls","type-mismatch"],"backgroundTag":"class-not-found","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}