{"record":{"id":"3eaea51e9ee86357","repo":"apache/hadoop","slug":"dest-filesystem-fs-geturi-getscheme-doesn","errorCode":null,"errorMessage":"Dest filesystem '${fs.getUri().getScheme()}' doesn't support concat.","messagePattern":"Dest filesystem '(.+?)' doesn't support concat\\.","errorType":"exception","errorClass":"PathIOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Concat.java","lineNumber":82,"sourceCode":"              target.path));\n    }\n    Path[] srcArray = new Path[srcList.size()];\n    for (int i = 0; i < args.size(); i++) {\n      PathData src = srcList.get(i);\n      if (!src.exists || !src.stat.isFile()) {\n        throw new FileNotFoundException(\n            String.format(\"%s does not exist or is not file.\", src.path));\n      }\n      srcArray[i] = src.path;\n    }\n    FileSystem fs = target.fs;\n    if (testFs != null) {\n      fs = testFs;\n    }\n    try {\n      fs.concat(target.path, srcArray);\n    } catch (UnsupportedOperationException exception) {\n      throw new PathIOException(\"Dest filesystem '\" + fs.getUri().getScheme()\n          + \"' doesn't support concat.\", exception);\n    }\n  }\n\n  @VisibleForTesting\n  static void setTestFs(FileSystem fs) {\n    testFs = fs;\n  }\n}\n","sourceCodeStart":64,"sourceCodeEnd":92,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Concat.java#L64-L92","documentation":"PathIOException thrown by Concat.java:82 when the underlying FileSystem.concat(target, srcArray) call raises UnsupportedOperationException. The shell catches it and reports which scheme failed: concat is a block-level merge that only some filesystem implementations (primarily HDFS) support; LocalFileSystem, ViewFs, and most object-store implementations do not implement it.","triggerScenarios":"'hadoop fs -concat /tmp/t /tmp/a /tmp/b' where /tmp resolves to the local filesystem (file://); the command run against viewfs:, s3a://, or another non-HDFS default FS; unit tests where Concat.setTestFs() injected a RawLocalFileSystem. Note the filesystem used is the TARGET's fs, so the scheme in the message is the target's scheme.","commonSituations":"Running shell commands on a gateway node whose fs.defaultFS is file:/// or a non-HDFS URI; scripts written for HDFS reused against local paths during testing; code calling FileSystem.get(conf).concat() on a FileSystem implementation that does not override it (the base class throws UnsupportedOperationException by design).","solutions":["Run the command against an HDFS target: 'hdfs dfs -concat hdfs://nn/data/target hdfs://nn/data/src1 hdfs://nn/data/src2'","If you only need the byte-level result on a non-HDFS filesystem, use 'hadoop fs -getmerge' or copy+append instead","In Java code, guard with try/catch UnsupportedOperationException around fs.concat(), or check 'hdfs'.equals(fs.getUri().getScheme()) first","Verify fs.defaultFS in core-site.xml points at the intended HDFS cluster when the command is given unqualified paths"],"exampleFix":"// before\nfs.concat(target, srcs);  // fs is RawLocalFileSystem -> UnsupportedOperationException\n\n// after\nif (\"hdfs\".equals(fs.getUri().getScheme())) {\n  fs.concat(target, srcs);\n} else {\n  throw new UnsupportedOperationException(\n      \"Dest filesystem '\" + fs.getUri().getScheme() + \"' doesn't support concat.\");\n}","handlingStrategy":"try-catch","validationCode":"if (!\"hdfs\".equals(fs.getUri().getScheme())) {\n  throw new UnsupportedOperationException(\n      \"Dest filesystem '\" + fs.getUri().getScheme() + \"' doesn't support concat.\");\n}","typeGuard":"static boolean supportsConcat(FileSystem fs) {\n  return \"hdfs\".equals(fs.getUri().getScheme());\n}","tryCatchPattern":"try {\n  fs.concat(target, srcArray);\n} catch (UnsupportedOperationException e) {\n  // fall back to a content-level merge (getmerge / copy+append)\n}","preventionTips":["Treat concat as an HDFS-only optimization; gate it on the target filesystem scheme","Set fs.defaultFS explicitly so unqualified paths cannot silently resolve to file://","In tests, use a MiniDFSCluster-based FileSystem, not RawLocalFileSystem, when exercising concat"],"tags":["hadoop","filesystem","concat","unsupported-operation","hdfs","shell"],"backgroundTag":"unsupported-filesystem-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}