apache/hadoop · error · IllegalArgumentException
Permissions must not be null
Error message
Permissions must not be null
What it means
Options.CreateOpts.Perms (FileSystem.create(path, CreateOpts.perms(perm), ...)) requires a non-null FsPermission; null throws IllegalArgumentException immediately because the option object would otherwise carry no permission at all.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Options.java:136
}
bytesPerChecksum = bpc;
}
public int getValue() { return bytesPerChecksum; }
}
public static class ChecksumParam extends CreateOpts {
private final ChecksumOpt checksumOpt;
protected ChecksumParam(ChecksumOpt csumOpt) {
checksumOpt = csumOpt;
}
public ChecksumOpt getValue() { return checksumOpt; }
}
public static class Perms extends CreateOpts {
private final FsPermission permissions;
protected Perms(FsPermission perm) {
if(perm == null) {
throw new IllegalArgumentException("Permissions must not be null");
}
permissions = perm;
}
public FsPermission getValue() { return permissions; }
}
public static class Progress extends CreateOpts {
private final Progressable progress;
protected Progress(Progressable prog) {
if(prog == null) {
throw new IllegalArgumentException("Progress must not be null");
}
progress = prog;
}
public Progressable getValue() { return progress; }
}
public static class CreateParent extends CreateOpts {View on GitHub (pinned to 2add963021)
Solutions
- Pass FsPermission.getFileDefault()/getDirDefault() (or an explicit umask-derived value) when the caller has no specific permission
- Omit the Perms option entirely so the FileSystem default applies
- Null-check optional parameters before building the opts array
Example fix
// before CreateOpts.perms(userPerm); // userPerm == null // after CreateOpts.perms(userPerm != null ? userPerm : FsPermission.getFileDefault());
Defensive patterns
Strategy: validation
Validate before calling
FsPermission perm = (permOpt != null) ? permOpt : FsPermission.getFileDefault(); out = fs.create(p, CreateOpts.perms(perm));
Prevention
- Substitute FsPermission.getFileDefault()/getDirDefault() for null
- Omit the Perms option to use the FS default
- Null-check optional parameters before building option arrays
When it happens
Trigger: CreateOpts.perms(null) or new CreateOpts.Perms(null) — commonly an optional permission parameter forwarded blindly from a helper method whose caller passed null.
Common situations: API wrappers with @Nullable permission parameters, config-driven permission code paths where the property is absent.
Related errors
- Progress must not be null
- no permission supplied
- Block size must be greater than 0
- Replication must be greater than 0
- Buffer size must be greater than 0
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/8288d868b0c53c60.
Report an issue: GitHub.