{"record":{"id":"945a5c6d42714d57","repo":"apache/hadoop","slug":"seterasurecodingpolicy-is-not-supported-for-httpfs","errorCode":null,"errorMessage":"setErasureCodingPolicy is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration","messagePattern":"setErasureCodingPolicy 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":2128,"sourceCode":"  @InterfaceAudience.Private\n  public static class FSSetErasureCodingPolicy\n      implements FileSystemAccess.FileSystemExecutor<Void> {\n\n    private Path path;\n    private String policyName;\n\n    public FSSetErasureCodingPolicy(String path, String policyName) {\n      this.path = new Path(path);\n      this.policyName = policyName;\n    }\n\n    @Override\n    public Void execute(FileSystem fs) throws IOException {\n      if (fs instanceof DistributedFileSystem) {\n        DistributedFileSystem dfs = (DistributedFileSystem) fs;\n        dfs.setErasureCodingPolicy(path, policyName);\n      } else {\n        throw new UnsupportedOperationException(\"setErasureCodingPolicy 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 getErasureCodingPolicy operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSGetErasureCodingPolicy\n      implements FileSystemAccess.FileSystemExecutor<String> {\n\n    private Path path;\n\n    public FSGetErasureCodingPolicy(String path) {\n      this.path = new Path(path);","sourceCodeStart":2110,"sourceCodeEnd":2146,"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#L2110-L2146","documentation":"FSOperations.FSSetErasureCodingPolicy.execute() applies SETERASURECODINGPOLICY only via DistributedFileSystem.setErasureCodingPolicy(); erasure coding is an HDFS-native feature with no generic FileSystem API. Any non-HDFS backing filesystem yields UnsupportedOperationException (HTTP 400 with this text), steering you to the server's fs.defaultFS.","triggerScenarios":"Client sends op=SETERASURECODINGPOLICY&ecpolicy=RS-6-3-1024k via webhdfs:// while HttpFS is backed by local FS, s3a, or another non-HDFS store.","commonSituations":"EC-enablement scripts run against an HttpFS URL on a gateway that fronts object storage; server config drift after moving workloads off HDFS; HttpFS test instance without HDFS.","solutions":["Point the HttpFS server's fs.defaultFS at HDFS and restart it","Apply EC policies via WebHDFS/hdfs CLI directly on the HDFS cluster","Confirm the directory is a writable HDFS dir (EC policies require empty dirs and EC-enabled zones)","If the target store is not HDFS, drop the EC step: object stores manage redundancy themselves"],"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; SETERASURECODINGPOLICY then reaches DFS -->","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static DistributedFileSystem asDfs(FileSystem fs) {\n  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;\n}","tryCatchPattern":"try {\n  fs.setErasureCodingPolicy(path, \"RS-6-3-1024k\");\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not supported for HttpFs\")) {\n    throw new UnsupportedFeatureException(\"EC requires HDFS-backed HttpFS; fix fs.defaultFS or use WebHDFS\", e);\n  }\n  throw e;\n}","preventionTips":["Gate EC setup scripts on a capability probe before applying policies in bulk","Apply EC via hdfs CLI/WebHDFS on the cluster rather than through a generic gateway","Verify the HttpFS server's fs.defaultFS after any storage migration"],"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-23T01:17:44.959Z"}