apache/hadoop · error · IllegalArgumentException
No value for {key} found in conf file.
Error message
No value for {key} found in conf file. What it means
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.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/oauth2/Utils.java:37
package org.apache.hadoop.hdfs.web.oauth2;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.conf.Configuration;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
@InterfaceAudience.Private
@InterfaceStability.Evolving
final class Utils {
private Utils() { /* Private constructor */ }
public static String notNull(Configuration conf, String key) {
String value = conf.get(key);
if(value == null) {
throw new IllegalArgumentException("No value for " + key +
" found in conf file.");
}
return value;
}
public static String postBody(String ... kv)
throws UnsupportedEncodingException {
if(kv.length % 2 != 0) {
throw new IllegalArgumentException("Arguments must be key value pairs");
}
StringBuilder sb = new StringBuilder();
int i = 0;
while(i < kv.length) {
if(i > 0) {
sb.append("&");
}View on GitHub (pinned to 2add963021)
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()
Example fix
<!-- before: provider set, credential missing --> <property> <name>dfs.webhdfs.oauth2.access.token.provider</name> <value>org.apache.hadoop.hdfs.web.oauth2.ConfCredentialBasedAccessTokenProvider</value> </property> <!-- after: add the key named in the message --> <property> <name>dfs.webhdfs.oauth2.credential</name> <value>my-client-secret</value> </property>
Defensive patterns
Strategy: validation
Validate before calling
static final String[] OAUTH2_REQUIRED = {
"dfs.webhdfs.oauth2.client.id",
"dfs.webhdfs.oauth2.refresh.url"
// plus provider-specific: dfs.webhdfs.oauth2.credential
// or dfs.webhdfs.oauth2.refresh.token
};
for (String k : OAUTH2_REQUIRED) {
if (conf.get(k) == null) {
throw new IllegalStateException("Missing required OAuth2 config: " + k);
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable to load OAuth2 connection factory.
- Credential has not been provided in configuration
- No more entry in " + f
- f + " already exists"
- Unsupported scheme: {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/d3aff03ef0dc1722.
Report an issue: GitHub.