apache/hadoop · error · IllegalArgumentException
UID must fit in 24 bits
Error message
UID must fit in 24 bits
What it means
Error "UID must fit in 24 bits" thrown in apache/hadoop.
Source
Thrown at hadoop-tools/hadoop-fs2img/src/main/java/org/apache/hadoop/hdfs/server/namenode/UGIResolver.java:59
public static final int GROUP_STRID_OFFSET = 16;
public static final long USER_GROUP_STRID_MASK = (1 << 24) - 1;
/**
* Permission is serialized as a 64-bit long. [0:24):[25:48):[48:64) (in Big
* Endian).
* The first and the second parts are the string ids of the user and
* group name, and the last 16 bits are the permission bits.
* @param owner name of owner
* @param group name of group
* @param permission Permission octects
* @return FSImage encoding of permissions
*/
protected final long buildPermissionStatus(
String owner, String group, short permission) {
long userId = users.get(owner);
if (0L != ((~USER_GROUP_STRID_MASK) & userId)) {
throw new IllegalArgumentException("UID must fit in 24 bits");
}
long groupId = groups.get(group);
if (0L != ((~USER_GROUP_STRID_MASK) & groupId)) {
throw new IllegalArgumentException("GID must fit in 24 bits");
}
return ((userId & USER_GROUP_STRID_MASK) << USER_STRID_OFFSET)
| ((groupId & USER_GROUP_STRID_MASK) << GROUP_STRID_OFFSET)
| permission;
}
private final Map<String, Integer> users;
private final Map<String, Integer> groups;
public UGIResolver() {
this(new HashMap<String, Integer>(), new HashMap<String, Integer>());
}
View on GitHub (pinned to 2add963021)
Solutions
- Remap users so every UID is below 2^24 before generating the image, e.g. supply a UGI mapping file with smaller IDs.
When it happens
Trigger: A user mapping supplied to UGIResolver produces a UID larger than 24 bits, which cannot be encoded into the fsimage's user/group ID space.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/3869ccffd055cb17.
Report an issue: GitHub.