apache/hadoop · error · IllegalArgumentException
Wrong FileSystem:
Error message
Wrong FileSystem:
What it means
Error "Wrong FileSystem: " thrown in apache/hadoop.
Source
Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java:499
* @param st HdfsFileStatus instance from NameNode
* @param opts Standard handle arguments
* @throws IllegalArgumentException If the FileStatus instance refers to a
* directory, symlink, or another namesystem.
* @throws UnsupportedOperationException If opts are not specified or both
* data and location are not allowed to change.
* @return A handle to the file.
*/
@Override
protected HdfsPathHandle createPathHandle(FileStatus st, HandleOpt... opts) {
if (!(st instanceof HdfsFileStatus)) {
throw new IllegalArgumentException("Invalid FileStatus "
+ st.getClass().getSimpleName());
}
if (st.isDirectory() || st.isSymlink()) {
throw new IllegalArgumentException("PathHandle only available for files");
}
if (!getUri().getAuthority().equals(st.getPath().toUri().getAuthority())) {
throw new IllegalArgumentException("Wrong FileSystem: " + st.getPath());
}
HandleOpt.Data data = HandleOpt.getOpt(HandleOpt.Data.class, opts)
.orElse(HandleOpt.changed(false));
HandleOpt.Location loc = HandleOpt.getOpt(HandleOpt.Location.class, opts)
.orElse(HandleOpt.moved(false));
HdfsFileStatus hst = (HdfsFileStatus) st;
final Path p;
final Optional<Long> inodeId;
if (loc.allowChange()) {
p = DFSUtilClient.makePathFromFileId(hst.getFileId());
inodeId = Optional.empty();
} else {
p = hst.getPath();
inodeId = Optional.of(hst.getFileId());
}
final Optional<Long> mtime = !data.allowChange()
? Optional.of(hst.getModificationTime())View on GitHub (pinned to 2add963021)
Solutions
- Use the FileSystem instance matching the file's URI scheme/authority.
- Resolve paths through FileSystem.get(URI, conf) for the correct filesystem.
When it happens
Trigger: A FileStatus or handle obtained from one FileSystem is passed to a DistributedFileSystem backed by a different filesystem, so the operation is rejected.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/a389409e642a30d4.
Report an issue: GitHub.