apache/hadoop · error · org.apache.hadoop.hdfs.util.XMLUtils.InvalidXmlException
Invalid value for FsAction
Error message
Invalid value for FsAction
What it means
fsActionFromXml() maps the PERM element of a permission/ACL stanza to an FsAction via FSACTION_SYMBOL_MAP, which contains exactly the eight rwx combinations ('---' through 'rwx'). A missing, empty, or malformed PERM value misses the map and yields InvalidXmlException('Invalid value for FsAction').
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLogOp.java:5548
Short.toString(mode.toShort()));
}
public static FsPermission fsPermissionFromXml(Stanza st)
throws InvalidXmlException {
short mode = Short.parseShort(st.getValue("MODE"));
return new FsPermission(mode);
}
private static void fsActionToXml(ContentHandler contentHandler, FsAction v)
throws SAXException {
XMLUtils.addSaxString(contentHandler, "PERM", v.SYMBOL);
}
private static FsAction fsActionFromXml(Stanza st)
throws InvalidXmlException {
FsAction v = FSACTION_SYMBOL_MAP.get(st.getValue("PERM"));
if (v == null)
throw new InvalidXmlException("Invalid value for FsAction");
return v;
}
private static void appendAclEntriesToXml(ContentHandler contentHandler,
List<AclEntry> aclEntries) throws SAXException {
for (AclEntry e : aclEntries) {
contentHandler.startElement("", "", "ENTRY", new AttributesImpl());
XMLUtils.addSaxString(contentHandler, "SCOPE", e.getScope().name());
XMLUtils.addSaxString(contentHandler, "TYPE", e.getType().name());
if (e.getName() != null) {
XMLUtils.addSaxString(contentHandler, "NAME", e.getName());
}
fsActionToXml(contentHandler, e.getPermission());
contentHandler.endElement("", "", "ENTRY");
}
}
private static List<AclEntry> readAclEntriesFromXml(Stanza st) {View on GitHub (pinned to 2add963021)
Solutions
- Fix PERM to exactly three characters matching [r-][w-][x-], e.g. 'r-x'.
- Regenerate the XML from the binary edits file rather than editing permissions by hand.
- If PERM is empty, check the stanza nesting — the element is probably missing or misplaced.
Example fix
<!-- before: octal / padded symbols --> <PERM>644</PERM> <!-- after: 3-char rwx symbol --> <PERM>rw-</PERM>
Defensive patterns
Strategy: validation
Validate before calling
String perm = st.getValue("PERM");
if (perm == null || !perm.matches("[r-][w-][x-]")) {
throw new IllegalArgumentException(
"PERM must match [r-][w-][x-]: " + perm);
} Try / catch
try {
FsAction a = FSEditLogOp.fsActionFromXml(st);
} catch (InvalidXmlException e) {
// fix the PERM element and re-run the conversion
} Prevention
- Do not edit permissions in offline-edits XML by hand.
- Pre-validate PERM with a [r-][w-][x-] regex before conversion.
- Prefer regenerating XML from the binary edits file.
When it happens
Trigger: OfflineEditsViewer XML round-trip where PERM is absent (empty string from a missing element), uppercase ('R--'), four characters ('r-x '), or uses octal ('644') instead of the 3-char rwx symbol.
Common situations: Hand-edited permission entries; sed/awk scripts rewriting the XML; conversion from tools that emit octal permissions or mangle stanza nesting so PERM comes back empty.
Related errors
- {} doesn't support modifyAclEntries
- {} doesn't support removeAclEntries
- {} doesn't support removeAcl
- {} doesn't support setAcl
- can't understand DelegationTokenIdentifier KIND {kind}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/77b13fca23d408f4.
Report an issue: GitHub.