{"record":{"id":"bf3d08a416b351fe","repo":"apache/hadoop","slug":"cannot-find-any-path-capability","errorCode":null,"errorMessage":"Cannot find any path capability","messagePattern":"Cannot find any path capability","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/cases/HdfsCompatServer.java","lineNumber":225,"sourceCode":"    allCaps.add(CommonPathCapabilities.FS_APPEND);\n    allCaps.add(CommonPathCapabilities.FS_CHECKSUMS);\n    allCaps.add(CommonPathCapabilities.FS_CONCAT);\n    allCaps.add(CommonPathCapabilities.FS_LIST_CORRUPT_FILE_BLOCKS);\n    allCaps.add(CommonPathCapabilities.FS_PATHHANDLES);\n    allCaps.add(CommonPathCapabilities.FS_PERMISSIONS);\n    allCaps.add(CommonPathCapabilities.FS_READ_ONLY_CONNECTOR);\n    allCaps.add(CommonPathCapabilities.FS_SNAPSHOTS);\n    allCaps.add(CommonPathCapabilities.FS_STORAGEPOLICY);\n    allCaps.add(CommonPathCapabilities.FS_SYMLINKS);\n    allCaps.add(CommonPathCapabilities.FS_TRUNCATE);\n    allCaps.add(CommonPathCapabilities.FS_XATTRS);\n    final Path base = getBasePath();\n    for (String cap : allCaps) {\n      if (fs().hasPathCapability(base, cap)) {\n        return;\n      }\n    }\n    throw new IOException(\"Cannot find any path capability\");\n  }\n}","sourceCodeStart":207,"sourceCodeEnd":227,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-compat-bench/src/main/java/org/apache/hadoop/fs/compat/cases/HdfsCompatServer.java#L207-L227","documentation":"HdfsCompatServer collects the union of CommonPathCapabilities (read-only connector, snapshots, storage policy, symlinks, truncate, xattrs, ...) and probes fs().hasPathCapability(base, cap) for each. If the filesystem under test reports none of them, it throws IOException('Cannot find any path capability'). hasPathCapability is how modern Hadoop filesystems advertise features; a filesystem answering false for all of them is unusable for the bench.","triggerScenarios":"Pointing -uri at a FileSystem that does not override hasPathCapability (the FileSystem default returns false for everything), a stub/empty test filesystem, or a FilterFileSystem wrapper that does not forward the call. The probe runs against getBasePath(), so a base path that resolves to a different filesystem than intended also triggers it.","commonSituations":"Custom or third-party connectors written before the PathCapability API (Hadoop 3.3.x era) that never implemented hasPathCapability; older connector versions; testing a wrapped filesystem (viewfs/filter) that drops capability queries.","solutions":["Run the bench against a filesystem that declares capabilities, e.g. HDFS (hdfs://...)","If you maintain the connector, override hasPathCapability(Path, String) and return true for the capabilities it genuinely supports (constants in CommonPathCapabilities)","Verify the -uri base path actually resolves to the filesystem you mean to test (mounts, default FS, symlinks)","Upgrade the connector to a release implementing PathCapability"],"exampleFix":"// before: connector inherits FileSystem.hasPathCapability -> always false\n// -> IOException: Cannot find any path capability\n\n// after\n@Override\npublic boolean hasPathCapability(Path path, String capability)\n    throws IOException {\n  switch (capability) {\n  case CommonPathCapabilities.FS_XATTRS:\n  case CommonPathCapabilities.FS_TRUNCATE:\n    return true;\n  default:\n    return super.hasPathCapability(path, capability);\n  }\n}","handlingStrategy":"validation","validationCode":"FileSystem fs = basePath.getFileSystem(conf);\nString[] probes = {\n    CommonPathCapabilities.FS_READ_ONLY_CONNECTOR,\n    CommonPathCapabilities.FS_SNAPSHOTS,\n    CommonPathCapabilities.FS_TRUNCATE,\n    CommonPathCapabilities.FS_XATTRS };\nboolean any = false;\nfor (String cap : probes) {\n  try {\n    if (fs.hasPathCapability(basePath, cap)) { any = true; break; }\n  } catch (IOException ignored) { /* treat as unsupported */ }\n}\nif (!any) {\n  throw new IOException(fs.getUri()\n      + \" reports no path capabilities; not usable for the compat bench\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["For custom FileSystem implementations, implement hasPathCapability as part of the class skeleton, declaring only genuinely supported capabilities","Smoke-test hasPathCapability on one known capability before launching any capability-driven test or bench","Log the probed base path and resolved FS URI so mismatches (wrong FS behind the path) are visible"],"tags":["hadoop-compat-bench","path-capability","filesystem","connector"],"backgroundTag":"unsupported-filesystem-capability","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}