{"record":{"id":"653ec7c26e0fdaa8","repo":"apache/hadoop","slug":"unseterasurecodingpolicy-is-not-supported-for-http","errorCode":null,"errorMessage":"unsetErasureCodingPolicy is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration","messagePattern":"unsetErasureCodingPolicy is not supported for HttpFs on (.+?)\\. Please check your fs\\.defaultFS configuration","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":400,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java","lineNumber":2183,"sourceCode":"   * Executor that performs a unsetErasureCodingPolicy operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSUnSetErasureCodingPolicy\n      implements FileSystemAccess.FileSystemExecutor<Void> {\n\n    private Path path;\n\n    public FSUnSetErasureCodingPolicy(String path) {\n      this.path = new Path(path);\n    }\n\n    @Override\n    public Void execute(FileSystem fs) throws IOException {\n      if (fs instanceof DistributedFileSystem) {\n        DistributedFileSystem dfs = (DistributedFileSystem) fs;\n        dfs.unsetErasureCodingPolicy(path);\n      } else {\n        throw new UnsupportedOperationException(\"unsetErasureCodingPolicy is \"\n            + \"not supported for HttpFs on \" + fs.getClass()\n            + \". Please check your fs.defaultFS configuration\");\n      }\n      return null;\n    }\n  }\n\n  /**\n   * Executor that performs a satisfyStoragePolicy operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSSatisyStoragePolicy\n      implements FileSystemAccess.FileSystemExecutor<Void> {\n\n    private Path path;\n\n    public FSSatisyStoragePolicy(String path) {\n      this.path = new Path(path);","sourceCodeStart":2165,"sourceCodeEnd":2201,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/server/FSOperations.java#L2165-L2201","documentation":"FSOperations.FSUnSetErasureCodingPolicy.execute() handles UNSETERASURECODINGPOLICY only on DistributedFileSystem, since EC policy removal is an HDFS-specific operation. With a non-HDFS backing filesystem it throws UnsupportedOperationException, which HttpExceptionUtils converts to HTTP 400 for REST callers, and the message points at the server-side fs.defaultFS.","triggerScenarios":"Client sends op=UNSETERASURECODINGPOLICY via webhdfs:// while the HttpFS gateway's filesystem is LocalFileSystem or an object store.","commonSituations":"Cleanup scripts reverting EC policies through the wrong gateway URL; HttpFS without HDFS config; environments where the same script targets both HDFS and non-HDFS mounts.","solutions":["Configure fs.defaultFS=hdfs://<nameservice> on the HttpFS server and restart","Run the unset via hdfs CLI or WebHDFS directly on the HDFS cluster","Make the client script tolerant of mixed backends: detect this error and skip instead of aborting the run","Audit httpfs-site.xml for the effective default filesystem rather than trusting host core-site.xml"],"exampleFix":"<!-- before: httpfs-site.xml -->\n<property><name>fs.defaultFS</name><value>file:///</value></property>\n<!-- after -->\n<property><name>fs.defaultFS</name><value>hdfs://ns1</value></property>\n<!-- restart HttpFS; UNSETERASURECODINGPOLICY then works on HDFS paths -->","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static DistributedFileSystem asDfs(FileSystem fs) {\n  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;\n}","tryCatchPattern":"try {\n  fs.unsetErasureCodingPolicy(path);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not supported for HttpFs\")) {\n    LOG.info(\"Skipping unsetErasureCodingPolicy({}): gateway not HDFS-backed\", path);\n    return;\n  }\n  throw e;\n}","preventionTips":["Make cleanup scripts idempotent and capability-aware: skip on 'not supported for HttpFs'","Run EC lifecycle operations against the HDFS cluster directly","Keep a registry of which gateways are HDFS-backed for automation"],"tags":["httpfs","webhdfs","erasure-coding","unsupported-operation","fs-defaultfs"],"backgroundTag":"unsupported-filesystem-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}