apache/hadoop · error · HadoopIllegalArgumentException
CreateParent option is set multiple times
Error message
CreateParent option is set multiple times
What it means
AbstractFileSystem.create accepts CreateOpts.CreateParent at most once; a second occurrence throws HadoopIllegalArgumentException. CreateParent governs whether missing parent directories are created, and the boolean must be resolved from a single option.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/AbstractFileSystem.java:590
throw new HadoopIllegalArgumentException(
"CreateChecksumType option is set multiple times");
}
checksumOpt = ((CreateOpts.ChecksumParam) iOpt).getValue();
} else if (CreateOpts.Perms.class.isInstance(iOpt)) {
if (permission != null) {
throw new HadoopIllegalArgumentException(
"Perms option is set multiple times");
}
permission = ((CreateOpts.Perms) iOpt).getValue();
} else if (CreateOpts.Progress.class.isInstance(iOpt)) {
if (progress != null) {
throw new HadoopIllegalArgumentException(
"Progress option is set multiple times");
}
progress = ((CreateOpts.Progress) iOpt).getValue();
} else if (CreateOpts.CreateParent.class.isInstance(iOpt)) {
if (createParent != null) {
throw new HadoopIllegalArgumentException(
"CreateParent option is set multiple times");
}
createParent = ((CreateOpts.CreateParent) iOpt).getValue();
} else {
throw new HadoopIllegalArgumentException("Unkown CreateOpts of type " +
iOpt.getClass().getName());
}
}
if (permission == null) {
throw new HadoopIllegalArgumentException("no permission supplied");
}
FsServerDefaults ssDef = getServerDefaults(f);
if (ssDef.getBlockSize() % ssDef.getBytesPerChecksum() != 0) {
throw new IOException("Internal error: default blockSize is" +
" not a multiple of default bytesPerChecksum ");
}View on GitHub (pinned to 2add963021)
Solutions
- Pass CreateOpts.createParent exactly once
- Replace with CreateOpts.setOpt(CreateOpts.createParent(b), opts)
- Dedupe the opts array by option class before create()
Example fix
// before
fc.create(f, flag, CreateOpts.createParent(false),
CreateOpts.createParent(true));
// after
fc.create(f, flag, CreateOpts.createParent(true)); Defensive patterns
Strategy: validation
Validate before calling
opts = CreateOpts.setOpt(CreateOpts.createParent(true), opts); // replaces existing CreateParent
Prevention
- Decide parent-creation semantics in one place, not in stacked wrappers
- Use CreateOpts.setOpt to override createParent
- Dedupe opts by class in shared create wrappers
When it happens
Trigger: Two CreateOpts.createParent(...) entries in one create() call, e.g. a convenience wrapper forcing parent creation appended after the caller's explicit createParent(false).
Common situations: Library convenience methods that "make sure parents exist" by appending the option regardless of what the caller passed; merge logic that concatenates option lists.
Related errors
- BlockSize option is set multiple times
- BufferSize option is set multiple times
- ReplicationFactor option is set multiple times
- BytesPerChecksum option is set multiple times
- CreateChecksumType option is set multiple times
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/092e71d19b5d10aa.
Report an issue: GitHub.