{"record":{"id":"d3aff03ef0dc1722","repo":"apache/hadoop","slug":"no-value-for-key-found-in-conf-file","errorCode":null,"errorMessage":"No value for {key} found in conf file.","messagePattern":"No value for (.+?) found in conf file\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/Utils.java","lineNumber":37,"sourceCode":"package org.apache.hadoop.hdfs.web.oauth2;\n\nimport org.apache.hadoop.classification.InterfaceAudience;\nimport org.apache.hadoop.classification.InterfaceStability;\nimport org.apache.hadoop.conf.Configuration;\n\nimport java.io.UnsupportedEncodingException;\nimport java.net.URLEncoder;\n\n@InterfaceAudience.Private\n@InterfaceStability.Evolving\nfinal class Utils {\n  private Utils() { /* Private constructor */ }\n\n  public static String notNull(Configuration conf, String key) {\n    String value = conf.get(key);\n\n    if(value == null) {\n      throw new IllegalArgumentException(\"No value for \" + key +\n          \" found in conf file.\");\n    }\n\n    return value;\n  }\n\n  public static String postBody(String ... kv)\n      throws UnsupportedEncodingException {\n    if(kv.length % 2 != 0) {\n      throw new IllegalArgumentException(\"Arguments must be key value pairs\");\n    }\n    StringBuilder sb = new StringBuilder();\n    int i = 0;\n\n    while(i < kv.length) {\n      if(i > 0) {\n        sb.append(\"&\");\n      }","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/Utils.java#L19-L55","documentation":"Utils.notNull(Configuration, key) is the oauth2 module's required-configuration guard: it throws IllegalArgumentException('No value for <key> found in conf file.') when conf.get(key) returns null, naming the exact missing key. It runs inside setConf of the oauth2 AccessTokenProviders, so it fires as soon as a WebHDFS-with-OAuth2 filesystem is initialized, before any request is made. Keys guarded this way include dfs.webhdfs.oauth2.credential, dfs.webhdfs.oauth2.refresh.token, dfs.webhdfs.oauth2.client.id, and dfs.webhdfs.oauth2.refresh.url.","triggerScenarios":"Initializing WebHdfsFileSystem with dfs.webhdfs.oauth2.access.token.provider set to ConfCredentialBasedAccessTokenProvider / ConfRefreshTokenBasedAccessTokenProvider / CredentialBasedAccessTokenProvider while any of their required keys (named in the message) is absent from the client Configuration.","commonSituations":"Enabling OAuth2 for S3A-style WebHDFS deployments but only configuring the provider class; putting oauth2 keys in hdfs-site.xml while the client only loads core-site.xml; XML typo in the property name; keys set on the gateway but missing on client machines.","solutions":["Add the property named in the message to the client's configuration (core-site.xml or the Configuration object used to create the FileSystem)","Confirm the file is actually loaded (check -conf stack or conf.get after load) and the name matches byte-for-byte — no trailing spaces","Provide all keys the chosen provider requires: credential provider needs dfs.webhdfs.oauth2.credential + client.id + refresh.url; refresh-token provider additionally needs dfs.webhdfs.oauth2.refresh.token","Fail fast in your own bootstrap by asserting required keys before FileSystem.get()"],"exampleFix":"<!-- before: provider set, credential missing -->\n<property>\n  <name>dfs.webhdfs.oauth2.access.token.provider</name>\n  <value>org.apache.hadoop.hdfs.web.oauth2.ConfCredentialBasedAccessTokenProvider</value>\n</property>\n<!-- after: add the key named in the message -->\n<property>\n  <name>dfs.webhdfs.oauth2.credential</name>\n  <value>my-client-secret</value>\n</property>","handlingStrategy":"validation","validationCode":"static final String[] OAUTH2_REQUIRED = {\n    \"dfs.webhdfs.oauth2.client.id\",\n    \"dfs.webhdfs.oauth2.refresh.url\"\n    // plus provider-specific: dfs.webhdfs.oauth2.credential\n    // or dfs.webhdfs.oauth2.refresh.token\n};\nfor (String k : OAUTH2_REQUIRED) {\n  if (conf.get(k) == null) {\n    throw new IllegalStateException(\"Missing required OAuth2 config: \" + k);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast at bootstrap: assert every required dfs.webhdfs.oauth2.* key before FileSystem.get()","Keep all oauth2 keys in the same client-visible core-site.xml and lint property names in config review","Add a config smoke test that initializes the FileSystem in CI"],"tags":["oauth2","webhdfs","configuration","missing-property"],"backgroundTag":"missing-configuration-key","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}