{"record":{"id":"3a81eea0f8a022a2","repo":"prestodb/presto","slug":"failed-to-create-broker-auth-provider","errorCode":null,"errorMessage":"Failed to create Broker auth provider","messagePattern":"Failed to create Broker auth provider","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/auth/PinotBrokerAuthenticationProvider.java","lineNumber":49,"sourceCode":"\n    @Inject\n    public PinotBrokerAuthenticationProvider(PinotConfig pinotConfig)\n    {\n        String type = pinotConfig.getBrokerAuthenticationType();\n        switch (type) {\n            case \"NONE\":\n                this.delegate = PinotEmptyAuthenticationProvider.instance();\n                break;\n            case \"PASSWORD\":\n                try {\n                    this.delegate = new PinotPasswordAuthenticationProvider(\n                            pinotConfig.getBrokerAuthenticationUser(),\n                            pinotConfig.getBrokerAuthenticationPassword(),\n                            PinotSessionProperties.class.getMethod(\"getBrokerAuthenticationUser\", ConnectorSession.class),\n                            PinotSessionProperties.class.getMethod(\"getBrokerAuthenticationPassword\", ConnectorSession.class));\n                }\n                catch (NoSuchMethodException e) {\n                    throw new RuntimeException(\"Failed to create Broker auth provider\", e);\n                }\n                break;\n            default:\n                throw new RuntimeException(\"Unknown authentication type - \" + type);\n        }\n    }\n\n    private PinotBrokerAuthenticationProvider(PinotAuthenticationProvider delegate)\n    {\n        this.delegate = requireNonNull(delegate, \"Delegate broker authentication provider is required\");\n    }\n\n    @Override\n    public Optional<String> getAuthenticationToken()\n    {\n        return delegate.getAuthenticationToken();\n    }\n","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-pinot-toolkit/src/main/java/com/facebook/presto/pinot/auth/PinotBrokerAuthenticationProvider.java#L31-L67","documentation":"The broker authentication provider for Pinot uses reflection to look up session-level credential getter methods (getBrokerAuthenticationUser/getBrokerAuthenticationPassword) on PinotSessionProperties. The constructor wraps a NoSuchMethodException in a RuntimeException, meaning the wired method names/signatures no longer exist on that class.","triggerScenarios":"Constructing PinotBrokerAuthenticationProvider with broker authentication enabled (user/password mode) and PinotSessionProperties.getMethod(...) throws NoSuchMethodException — i.e. the session property methods were renamed, moved, or removed.","commonSituations":"Connector code refactoring renamed session property getters while the auth provider still references old names; partial builds or mismatched jar versions where the auth class and session-properties class come from different builds.","solutions":["Rebuild the connector so all classes are from the same version","Update the reflective method names in PinotBrokerAuthenticationProvider to match the current PinotSessionProperties API (ideally replace reflection with direct method references)","Check git history for renames of getBrokerAuthenticationUser/getBrokerAuthenticationPassword","Verify broker.auth type config actually requires user/password mode before construction"],"exampleFix":"// before\nPinotSessionProperties.class.getMethod(\"getBrokerAuthenticationUser\", ConnectorSession.class)\n// after\nPinotSessionProperties::getBrokerAuthenticationUser  // direct reference, compile-time checked\n(session -> PinotSessionProperties.getBrokerAuthenticationUser(session))","handlingStrategy":"try-catch","validationCode":"// verify the session property getter exists before enabling broker auth\ntry {\n  PinotSessionProperties.class.getMethod(\"getBrokerAuthenticationUser\", ConnectorSession.class);\n  PinotSessionProperties.class.getMethod(\"getBrokerAuthenticationPassword\", ConnectorSession.class);\n} catch (NoSuchMethodException e) {\n  throw new IllegalStateException(\"Connector build lacks broker auth session properties\", e);\n}","typeGuard":null,"tryCatchPattern":"try {\n  provider = new PinotBrokerAuthenticationProvider(pinotConfig);\n} catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"Failed to create Broker auth provider\")) {\n    log.error(\"Broker auth provider init failed; falling back to no-auth or manual headers\", e);\n    provider = PinotAuthenticationProvider.none();\n  } else throw e;\n}","preventionTips":["Deploy the connector as one consistent build (no mixed jars)","Prefer direct method references over reflection when modifying the connector","Smoke-test broker auth initialization at startup, not per query","Track renames of PinotSessionProperties methods in code review"],"tags":["pinot","authentication","reflection","compatibility"],"backgroundTag":"auth-provider-init-failed","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}