apache/hadoop · error · IllegalArgumentException
Unknown OpenFileType: {}
Error message
Unknown OpenFileType: {} What it means
FSNamesystem.listOpenFiles dispatches on the EnumSet of OpenFilesType supplied by the client. The deployed enum has only ALL_OPEN_FILES and BLOCKING_DECOMMISSION; if the set contains neither (empty set or a value unknown to this NameNode), control falls into the final else branch and throws IllegalArgumentException('Unknown OpenFileType: ...').
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java:2091
EnumSet<OpenFilesType> openFilesTypes, String path) throws IOException {
INode.checkAbsolutePath(path);
final String operationName = "listOpenFiles";
checkSuperuserPrivilege(operationName, path);
checkOperation(OperationCategory.READ);
BatchedListEntries<OpenFileEntry> batchedListEntries;
String normalizedPath = new Path(path).toString(); // normalize path.
try {
readLock(RwLockMode.FS);
try {
checkOperation(OperationCategory.READ);
if (openFilesTypes.contains(OpenFilesType.ALL_OPEN_FILES)) {
batchedListEntries = leaseManager.getUnderConstructionFiles(prevId,
normalizedPath);
} else {
if (openFilesTypes.contains(OpenFilesType.BLOCKING_DECOMMISSION)) {
batchedListEntries = getFilesBlockingDecom(prevId, normalizedPath);
} else {
throw new IllegalArgumentException("Unknown OpenFileType: "
+ openFilesTypes);
}
}
} finally {
readUnlock(RwLockMode.FS, operationName, getLockReportInfoSupplier(null));
}
} catch (AccessControlException e) {
logAuditEvent(false, operationName, null);
throw e;
}
logAuditEvent(true, operationName, null);
return batchedListEntries;
}
public BatchedListEntries<OpenFileEntry> getFilesBlockingDecom(long prevId,
String path) {
assert hasReadLock(RwLockMode.FS);
final List<OpenFileEntry> openFileEntries = Lists.newArrayList();View on GitHub (pinned to 2add963021)
Solutions
- Pass a valid non-empty set: EnumSet.of(OpenFilesType.ALL_OPEN_FILES) or EnumSet.of(OpenFilesType.BLOCKING_DECOMMISSION)
- Rebuild the client against the same Hadoop version as the NameNode to remove enum skew
- Use `hdfs dfsadmin -listOpenFiles` (optionally -blockingDecommission), which always sends a valid set
Example fix
// before
OpenFilesType[] types = typesFromConfig; // may be empty -> IllegalArgumentException
RemoteIterator<OpenFileEntry> it = dfs.listOpenFiles(types);
// after
EnumSet<OpenFilesType> set = (types == null || types.length == 0)
? EnumSet.of(OpenFilesType.ALL_OPEN_FILES)
: EnumSet.noneOf(OpenFilesType.class);
if (types != null) Collections.addAll(set, types);
RemoteIterator<OpenFileEntry> it = dfs.listOpenFiles(set.toArray(new OpenFilesType[0])); Defensive patterns
Strategy: validation
Validate before calling
Set<OpenFilesType> t = (types == null || types.isEmpty())
? EnumSet.of(OpenFilesType.ALL_OPEN_FILES) : EnumSet.copyOf(types);
boolean valid = t.stream().allMatch(v ->
v == OpenFilesType.ALL_OPEN_FILES || v == OpenFilesType.BLOCKING_DECOMMISSION);
if (!valid) t = EnumSet.of(OpenFilesType.ALL_OPEN_FILES); Type guard
static boolean isOpenFilesQueryValid(Collection<OpenFilesType> c) {
if (c == null || c.isEmpty()) return false;
for (OpenFilesType v : c) {
if (v != OpenFilesType.ALL_OPEN_FILES && v != OpenFilesType.BLOCKING_DECOMMISSION) return false;
}
return true;
} Try / catch
catch (IllegalArgumentException e) { if (e.getMessage() != null && e.getMessage().contains("Unknown OpenFileType")) { query = EnumSet.of(OpenFilesType.ALL_OPEN_FILES); continue; } throw e; } Prevention
- Default empty filter sets to ALL_OPEN_FILES instead of sending them
- Pin client and server to the same Hadoop release to avoid enum drift
When it happens
Trigger: Calling ClientProtocol.listOpenFiles / DistributedFileSystem.listOpenFiles with an empty OpenFilesType array (e.g. EnumSet.noneOf(OpenFilesType.class)), or a client compiled against a Hadoop version whose OpenFilesType values differ from the NameNode's so the deserialized set matches no branch.
Common situations: Custom monitoring tooling that builds the filter set from config and ends up empty; client/server version skew after a rolling upgrade; code that treats a null filter as 'none' instead of defaulting to 'all'.
Related errors
- Unexpected HAServiceStateProto:
- Illagal value: {NAME} = {value} < MIN = {MIN}
- Unknown nameservice: {}
- Configuration has multiple addresses that match local node's
- Cannot delete/rename non-empty protected directory {}
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/10665d1bafa38f31.
Report an issue: GitHub.