{"record":{"id":"576537a5a9120b55","repo":"apache/hadoop","slug":"cannot-recoverlease-through-a-symlink-to-a-non-dis","errorCode":null,"errorMessage":"Cannot recoverLease through a symlink to a non-DistributedFileSystem: ","messagePattern":"Cannot recoverLease through a symlink to a non-DistributedFileSystem: ","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java","lineNumber":333,"sourceCode":"   * @return true if the file is already closed\n   * @throws IOException if an error occurs\n   */\n  @Override\n  public boolean recoverLease(final Path f) throws IOException {\n    Path absF = fixRelativePart(f);\n    return new FileSystemLinkResolver<Boolean>() {\n      @Override\n      public Boolean doCall(final Path p) throws IOException{\n        return dfs.recoverLease(getPathName(p));\n      }\n      @Override\n      public Boolean next(final FileSystem fs, final Path p)\n          throws IOException {\n        if (fs instanceof DistributedFileSystem) {\n          DistributedFileSystem myDfs = (DistributedFileSystem)fs;\n          return myDfs.recoverLease(p);\n        }\n        throw new UnsupportedOperationException(\"Cannot recoverLease through\" +\n            \" a symlink to a non-DistributedFileSystem: \" + f + \" -> \" + p);\n      }\n    }.resolve(this, absF);\n  }\n\n  @Override\n  public FSDataInputStream open(Path f, final int bufferSize)\n      throws IOException {\n    statistics.incrementReadOps(1);\n    storageStatistics.incrementOpCounter(OpType.OPEN);\n    Path absF = fixRelativePart(f);\n    return new FileSystemLinkResolver<FSDataInputStream>() {\n      @Override\n      public FSDataInputStream doCall(final Path p) throws IOException {\n        final DFSInputStream dfsis =\n            dfs.open(getPathName(p), bufferSize, verifyChecksum);\n        try {\n          return dfs.createWrappedInputStream(dfsis);","sourceCodeStart":315,"sourceCodeEnd":351,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java#L315-L351","documentation":"Error \"Cannot recoverLease through a symlink to a non-DistributedFileSystem: \" thrown in apache/hadoop.","triggerScenarios":"recoverLease is called on a path that is a symlink whose target resolves to a non-DistributedFileSystem, which HDFS cannot operate on.","commonSituations":"See trigger scenarios.","solutions":["Call recoverLease on the real HDFS path, not on a symlink pointing to another filesystem.","Resolve the symlink target and confirm it belongs to a DistributedFileSystem before recovering the lease."],"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"}