apache/iceberg · warning
Hadoop user is null, defaulting to user.name
Error message
Hadoop user is null, defaulting to user.name
What it means
Companion fallback of currentUser(): after a failed UGI lookup, the short username is still null, so the code logs this warning and returns the JVM 'user.name' system property instead. Identity comes from the OS/JVM rather than Hadoop, which may not match the intended metastore user.
Solutions
- Pass -Duser.name=<hadoop-user> as a JVM argument to align the fallback identity
- Fix the root cause: put Hadoop config on the classpath or initialize UGI so getCurrentUser works
- Verify which user HMS sees (e.g. in metastore logs) and align configuration accordingly
Example fix
// before java -jar app.jar // after java -Duser.name=iceberg_svc -jar app.jar
Defensive patterns
Strategy: validation
Validate before calling
String user = System.getProperty("user.name"); if (user == null || user.equals("root")) { /* fix -Duser.name before running */ } Prevention
- Set -Duser.name to the intended service identity in container/launch scripts
- Verify HMS-side principal alignment when using Kerberos
- Log the resolved identity at startup and compare against expected
When it happens
Trigger: UserGroupInformation.getCurrentUser() throws IOException AND the caught path leaves username null, so the else branch reads System.getProperty("user.name").
Common situations: Containers where the OS user (e.g. 'root' or a UID) differs from the Kerberos/Hadoop identity expected by HMS; entitlement or ownership checks then record the wrong user.
Related errors
- Cannot assume role to sign REST requests because is not…
- Configuration was not serialized on purpose but was not set…
- Error adding Hadoop resource
- Failed to get Hadoop user
- Failed to load Configuration after loading Configurable
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/ee8b4050d27d7a5d.
Report an issue: GitHub.
Appendix: source
Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveHadoopUtil.java:43
public class HiveHadoopUtil {
private static final Logger LOG = LoggerFactory.getLogger(HiveHadoopUtil.class);
private HiveHadoopUtil() {}
public static String currentUser() {
String username = null;
try {
username = UserGroupInformation.getCurrentUser().getShortUserName();
} catch (IOException e) {
LOG.warn("Failed to get Hadoop user", e);
}
if (username != null) {
return username;
} else {
LOG.warn("Hadoop user is null, defaulting to user.name");
return System.getProperty("user.name");
}
}
}
View on GitHub (pinned to 86d9c8fc54)