apache/hadoop · error · UnsupportedFileSystemException
FileSystem '{}'is not a ViewFileSystem.
Error message
FileSystem '{}'is not a ViewFileSystem. What it means
ViewFileSystemUtil.getStatus(FileSystem, Path) computes per-mount-point FsStatus but only accepts ViewFileSystem or ViewFileSystemOverloadScheme instances. Any other FileSystem (plain DistributedFileSystem, RawLocalFileSystem, S3A, HarFs, ...) fails fast with UnsupportedFileSystemException("FileSystem '<uri>'is not a ViewFileSystem.") before any status is read.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystemUtil.java:110
*
* "/dept/eng" Not a mount point, but a valid (1), (2), (3), (4)
* internal dir in the mount tree
* and resolved down to "/" path.
*
* "/erp" Doesn't match or leads to or
* over any valid mount points None
*
*
* @param fileSystem - ViewFileSystem on which mount point exists
* @param path - URI for which FsStatus is requested
* @return Map of ViewFsMountPoint and FsStatus
* @throws IOException raised on errors performing I/O.
*/
public static Map<MountPoint, FsStatus> getStatus(
FileSystem fileSystem, Path path) throws IOException {
if (!(isViewFileSystem(fileSystem)
|| isViewFileSystemOverloadScheme(fileSystem))) {
throw new UnsupportedFileSystemException("FileSystem '"
+ fileSystem.getUri() + "'is not a ViewFileSystem.");
}
ViewFileSystem viewFileSystem = (ViewFileSystem) fileSystem;
String viewFsUriPath = viewFileSystem.getUriPath(path);
boolean isPathOverMountPoint = false;
boolean isPathLeadingToMountPoint = false;
boolean isPathIncludesAllMountPoint = false;
Map<MountPoint, FsStatus> mountPointMap = new HashMap<>();
for (MountPoint mountPoint : viewFileSystem.getMountPoints()) {
String[] mountPointPathComponents = InodeTree.breakIntoPathComponents(
mountPoint.getMountedOnPath().toString());
String[] incomingPathComponents =
InodeTree.breakIntoPathComponents(viewFsUriPath);
int pathCompIndex;
for (pathCompIndex = 0; pathCompIndex < mountPointPathComponents.length &&
pathCompIndex < incomingPathComponents.length; pathCompIndex++) {
if (!mountPointPathComponents[pathCompIndex].equals(View on GitHub (pinned to 2add963021)
Solutions
- Guard the call with ViewFileSystemUtil.isViewFileSystem(fs) || ViewFileSystemUtil.isViewFileSystemOverloadScheme(fs) and branch to fs.getStatus() otherwise
- Construct the viewfs FileSystem explicitly: FileSystem.get(new URI("viewfs://cluster"), conf)
- Ensure the tool is pointed at a deployment whose defaultFS is the viewfs mount table
Example fix
// before
Map<MountPoint, FsStatus> m = ViewFileSystemUtil.getStatus(fs, path); // throws for hdfs://
// after
if (ViewFileSystemUtil.isViewFileSystem(fs)
|| ViewFileSystemUtil.isViewFileSystemOverloadScheme(fs)) {
Map<MountPoint, FsStatus> m = ViewFileSystemUtil.getStatus(fs, path);
} else {
FsStatus s = fs.getStatus(path); // single-FS fallback path
} Defensive patterns
Strategy: type-guard
Validate before calling
if (!ViewFileSystemUtil.isViewFileSystem(fs)
&& !ViewFileSystemUtil.isViewFileSystemOverloadScheme(fs)) {
FsStatus s = fs.getStatus(path); // single-FS path
} else {
Map<MountPoint, FsStatus> m = ViewFileSystemUtil.getStatus(fs, path);
} Type guard
static boolean isViewFsCapable(FileSystem fs) {
// ViewFileSystemOverloadScheme extends ViewFileSystem, so one check covers both
return fs instanceof org.apache.hadoop.fs.viewfs.ViewFileSystem;
} Try / catch
try {
statuses = ViewFileSystemUtil.getStatus(fs, path);
} catch (UnsupportedFileSystemException e) {
statuses = Map.of(); // fall back to fs.getStatus(path) for plain filesystems
} Prevention
- Do not hardcode ViewFileSystemUtil calls for user-supplied FileSystem instances
- Test such utils with LocalFileSystem AND a viewfs test harness (ViewFileSystemTestSetup)
When it happens
Trigger: Calling ViewFileSystemUtil.getStatus(FileSystem.get(conf), path) when the Configuration resolves to a non-viewfs scheme; helper code shared between unit tests (local FS) and production (viewfs) passing whatever FileSystem it was handed.
Common situations: Cluster-capacity UIs and ops tooling that assume the defaultFS is always viewfs:// (federation) but are run on a single-cluster gateway where defaultFS=hdfs://; test harnesses using LocalFileSystem through the same code path.
Related errors
- getStatus on path `{}' is not within a mount point
- getXAttrs on path `{}' is not within a mount point
- listXAttrs on path `{}' is not within a mount point
- getQuotaUsage on path `{}' is not within a mount point
- getStoragePolicy on path `{}' is not within a mount point
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/87f98bbcc03375c6.
Report an issue: GitHub.