{"record":{"id":"33a3c0a2334996eb","repo":"apache/hadoop","slug":"geterasurecodingpolicy-is-not-supported-for-httpfs","errorCode":null,"errorMessage":"getErasureCodingPolicy is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration","messagePattern":"getErasureCodingPolicy 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":2156,"sourceCode":"   */\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);\n    }\n\n    @Override\n    public String execute(FileSystem fs) throws IOException {\n      ErasureCodingPolicy policy = null;\n      if (fs instanceof DistributedFileSystem) {\n        DistributedFileSystem dfs = (DistributedFileSystem) fs;\n        policy = dfs.getErasureCodingPolicy(path);\n      } else {\n        throw new UnsupportedOperationException(\"getErasureCodingPolicy is \"\n            + \"not supported for HttpFs on \" + fs.getClass()\n            + \". Please check your fs.defaultFS configuration\");\n      }\n      return JsonUtil.toJsonString(policy);\n    }\n  }\n\n  /**\n   * 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);","sourceCodeStart":2138,"sourceCodeEnd":2174,"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#L2138-L2174","documentation":"FSOperations.FSGetErasureCodingPolicy.execute() resolves GETERASURECODINGPOLICY only through DistributedFileSystem.getErasureCodingPolicy(path); erasure coding state is meaningless outside HDFS, so the executor throws UnsupportedOperationException for any other backing filesystem (HTTP 400 at the REST layer).","triggerScenarios":"Client sends op=GETERASURECODINGPOLICY for a path via webhdfs:// when the HttpFS server's fs.defaultFS resolves to a non-HDFS FileSystem.","commonSituations":"Storage-policy auditing tools walking paths through an HttpFS gateway; mixed lakehouse where some mounts are object storage; stale server config after an HDFS-to-object-store migration.","solutions":["Set the HttpFS server's fs.defaultFS to the HDFS nameservice and restart","Query EC policy with WebHDFS directly against the NameNode","Skip EC inspection for deployments known not to be HDFS","Verify which config file the running HttpFS process actually loaded (startup log) before assuming the setting took effect"],"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; GETERASURECODINGPOLICY then returns policy JSON -->","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static DistributedFileSystem asDfs(FileSystem fs) {\n  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;\n}","tryCatchPattern":"try {\n  ErasureCodingPolicy p = fs.getErasureCodingPolicy(path);\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not supported for HttpFs\")) {\n    return Optional.empty(); // non-HDFS backing: EC state undefined\n  }\n  throw e;\n}","preventionTips":["Treat this as a capability signal: stop polling EC state on non-HDFS gateways","Audit tools should report 'EC: n/a' instead of erroring the whole audit","Confirm gateway backing with GETSERVERDEFAULTS before enabling EC views"],"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"}