{"record":{"id":"f91ea4c9c7148c62","repo":"apache/pulsar","slug":"required-configuration-parameter-name","errorCode":null,"errorMessage":"Required configuration parameter: ${name}","messagePattern":"Required configuration parameter: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/oauth2/FlowBase.java","lineNumber":262,"sourceCode":"    }\n\n    public void initialize() throws PulsarClientException {\n        try {\n            this.metadata = createMetadataResolver().resolve();\n        } catch (IOException e) {\n            log.error().exception(e).log(\"Unable to retrieve OAuth 2.0 server metadata\");\n            throw new PulsarClientException.AuthenticationException(\"Unable to retrieve OAuth 2.0 server metadata\");\n        }\n    }\n\n    protected MetadataResolver createMetadataResolver() {\n        return DefaultMetadataResolver.fromIssuerUrl(issuerUrl, getHttpClient(), wellKnownMetadataPath);\n    }\n\n    static String parseParameterString(Map<String, String> params, String name) {\n        String s = params.get(name);\n        if (StringUtils.isEmpty(s)) {\n            throw new IllegalArgumentException(\"Required configuration parameter: \" + name);\n        }\n        return s;\n    }\n\n    static URL parseParameterUrl(Map<String, String> params, String name) {\n        String s = params.get(name);\n        if (StringUtils.isEmpty(s)) {\n            throw new IllegalArgumentException(\"Required configuration parameter: \" + name);\n        }\n        try {\n            return new URL(s);\n        } catch (MalformedURLException e) {\n            throw new IllegalArgumentException(\"Malformed configuration parameter: \" + name);\n        }\n    }\n\n    static Duration parseParameterDuration(Map<String, String> params, String name) {\n        String value = params.get(name);","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-client/src/main/java/org/apache/pulsar/client/impl/auth/oauth2/FlowBase.java#L244-L280","documentation":"FlowBase.parseParameterString extracts a required auth parameter by name and throws IllegalArgumentException('Required configuration parameter: <name>') if the value is missing or empty. It enforces mandatory OAuth2 configuration such as issuerUrl and privateKey before the client starts.","triggerScenarios":"Building AuthenticationOAuth2 without issuerUrl or privateKey in the auth parameter map; passing a null/empty string value; parameters dropped by config-loading code that filters empty values.","commonSituations":"Environment variable for the parameter not set so interpolation yields empty; missing key in YAML; constructor path that bypasses defaults and requires explicit params.","solutions":["Provide all required params: issuerUrl, privateKey (and audience if required by the IdP)","Check the config source actually loads the key (env var, secret mount)","Add a startup validation step printing which params are present"],"exampleFix":"// before\nMap<String, String> params = new HashMap<>(); // missing issuerUrl\nauth.configure(...);\n// after\nMap<String, String> params = new HashMap<>();\nparams.put(\"issuerUrl\", \"https://auth.example.com\");\nparams.put(\"privateKey\", \"file:///etc/pulsar/auth/key.json\");","handlingStrategy":"validation","validationCode":"Map<String, String> required = Map.of(\"issuerUrl\", issuerUrl, \"privateKey\", privateKey);\nfor (var e : required.entrySet()) {\n    if (e.getValue() == null || e.getValue().isBlank()) {\n        throw new IllegalStateException(\"Required configuration parameter missing: \" + e.getKey());\n    }\n}","typeGuard":"boolean hasNonBlank(java.util.Map<String,String> params, String name) {\n    String v = params.get(name);\n    return v != null && !v.isBlank();\n}","tryCatchPattern":"try {\n    flow.initialize();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Required configuration parameter\")) {\n        throw new ConfigException(\"Provide all required OAuth2 params (issuerUrl, privateKey): \" + e.getMessage());\n    }\n    throw e;\n}","preventionTips":["List and assert required OAuth2 params at application startup","Avoid env-var interpolation silently producing empty strings","Keep a canonical sample authParams configuration and diff against it"],"tags":["config","oauth2","missing-parameter"],"backgroundTag":"missing-config-parameter","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}