{"record":{"id":"b12ce3e94169ea4b","repo":"apache/hadoop","slug":"cannot-perform-unsetstoragepolicy-on-a-non-distrib","errorCode":null,"errorMessage":"Cannot perform unsetStoragePolicy on a non-DistributedFileSystem: ","messagePattern":"Cannot perform unsetStoragePolicy on 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":904,"sourceCode":"  @Override\n  public void unsetStoragePolicy(final Path src)\n      throws IOException {\n    statistics.incrementWriteOps(1);\n    storageStatistics.incrementOpCounter(OpType.UNSET_STORAGE_POLICY);\n    Path absF = fixRelativePart(src);\n    new FileSystemLinkResolver<Void>() {\n      @Override\n      public Void doCall(final Path p) throws IOException {\n        dfs.unsetStoragePolicy(getPathName(p));\n        return null;\n      }\n      @Override\n      public Void next(final FileSystem fs, final Path p) throws IOException {\n        if (fs instanceof DistributedFileSystem) {\n          ((DistributedFileSystem) fs).unsetStoragePolicy(p);\n          return null;\n        } else {\n          throw new UnsupportedOperationException(\n              \"Cannot perform unsetStoragePolicy on a \"\n                  + \"non-DistributedFileSystem: \" + src + \" -> \" + p);\n        }\n      }\n    }.resolve(this, absF);\n  }\n\n  @Override\n  public BlockStoragePolicySpi getStoragePolicy(Path path) throws IOException {\n    statistics.incrementReadOps(1);\n    storageStatistics.incrementOpCounter(OpType.GET_STORAGE_POLICY);\n    Path absF = fixRelativePart(path);\n\n    return new FileSystemLinkResolver<BlockStoragePolicySpi>() {\n      @Override\n      public BlockStoragePolicySpi doCall(final Path p) throws IOException {\n        return getClient().getStoragePolicy(getPathName(p));\n      }","sourceCodeStart":886,"sourceCodeEnd":922,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java#L886-L922","documentation":"Error \"Cannot perform unsetStoragePolicy on a non-DistributedFileSystem: \" thrown in apache/hadoop.","triggerScenarios":"unsetStoragePolicy is invoked through a symlink that resolves to a non-DistributedFileSystem, which does not support storage policies.","commonSituations":"See trigger scenarios.","solutions":["Run unsetStoragePolicy on the real DistributedFileSystem path, not via a symlink to another filesystem.","Resolve the symlink and issue the operation against the target DistributedFileSystem."],"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"}