{"record":{"id":"68115243e069693e","repo":"apache/hadoop","slug":"cannot-concat-with-a-symlink-target","errorCode":null,"errorMessage":"Cannot concat with a symlink target: ","messagePattern":"Cannot concat with a symlink target: ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java","lineNumber":992,"sourceCode":"    Path absF = fixRelativePart(trg);\n    // Make all srcs absolute\n    Path[] srcs = new Path[psrcs.length];\n    for (int i=0; i<psrcs.length; i++) {\n      srcs[i] = fixRelativePart(psrcs[i]);\n    }\n    // Try the concat without resolving any links\n    String[] srcsStr = new String[psrcs.length];\n    try {\n      for (int i=0; i<psrcs.length; i++) {\n        srcsStr[i] = getPathName(srcs[i]);\n      }\n      dfs.concat(getPathName(absF), srcsStr);\n    } catch (UnresolvedLinkException e) {\n      // Exception could be from trg or any src.\n      // Fully resolve trg and srcs. Fail if any of them are a symlink.\n      FileStatus stat = getFileLinkStatus(absF);\n      if (stat.isSymlink()) {\n        throw new IOException(\"Cannot concat with a symlink target: \"\n            + trg + \" -> \" + stat.getPath());\n      }\n      absF = fixRelativePart(stat.getPath());\n      for (int i=0; i<psrcs.length; i++) {\n        stat = getFileLinkStatus(srcs[i]);\n        if (stat.isSymlink()) {\n          throw new IOException(\"Cannot concat with a symlink src: \"\n              + psrcs[i] + \" -> \" + stat.getPath());\n        }\n        srcs[i] = fixRelativePart(stat.getPath());\n      }\n      // Try concat again. Can still race with another symlink.\n      for (int i=0; i<psrcs.length; i++) {\n        srcsStr[i] = getPathName(srcs[i]);\n      }\n      dfs.concat(getPathName(absF), srcsStr);\n    }\n  }","sourceCodeStart":974,"sourceCodeEnd":1010,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java#L974-L1010","documentation":"Error \"Cannot concat with a symlink target: \" thrown in apache/hadoop.","triggerScenarios":"concat is called with a target path that is a symlink; concat requires real DFS paths for both target and sources.","commonSituations":"See trigger scenarios.","solutions":["Pass the concat target as a direct HDFS path, not a symlink.","Resolve symlinks before calling concat so the target is a real DFS file."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}