{"record":{"id":"dee44a5a0f8f26cb","repo":"apache/hadoop","slug":"geterasurecodingpolicies-is-not-supported-for-http","errorCode":null,"errorMessage":"getErasureCodingPolicies is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration","messagePattern":"getErasureCodingPolicies 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":2365,"sourceCode":"\n  /**\n   * Executor that performs a FSGetErasureCodingPolicies operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSGetErasureCodingPolicies\n      implements FileSystemAccess.FileSystemExecutor<String> {\n\n    public FSGetErasureCodingPolicies() {\n    }\n\n    @Override\n    public String execute(FileSystem fs) throws IOException {\n      Collection<ErasureCodingPolicyInfo> ecPolicyInfos = null;\n      if (fs instanceof DistributedFileSystem) {\n        DistributedFileSystem dfs = (DistributedFileSystem) fs;\n        ecPolicyInfos = dfs.getAllErasureCodingPolicies();\n      } else {\n        throw new UnsupportedOperationException(\"getErasureCodingPolicies is \" +\n            \"not supported for HttpFs on \" + fs.getClass() +\n            \". Please check your fs.defaultFS configuration\");\n      }\n      HttpFSServerWebApp.get().getMetrics().incrOpsAllECPolicies();\n      return JsonUtil.toJsonString(ecPolicyInfos.stream().toArray(ErasureCodingPolicyInfo[]::new));\n    }\n  }\n\n  /**\n   * Executor that performs a FSGetErasureCodingCodecs operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSGetErasureCodingCodecs\n      implements FileSystemAccess.FileSystemExecutor<Map> {\n\n    public FSGetErasureCodingCodecs() {\n    }\n","sourceCodeStart":2347,"sourceCodeEnd":2383,"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#L2347-L2383","documentation":"FSOperations.FSGetErasureCodingPolicies.execute() lists all EC policies via DistributedFileSystem.getAllErasureCodingPolicies(); like the other EC executors it refuses non-HDFS backing filesystems with UnsupportedOperationException (HTTP 400 to REST clients). The metrics increment (incrOpsAllECPolicies) happens only after the DFS branch succeeds, so failing calls leave the counter untouched.","triggerScenarios":"Client sends op=GETERASURECODINGPOLICIES via webhdfs:// while the HttpFS server's FileSystemAccess layer opened a non-HDFS filesystem from its fs.defaultFS.","commonSituations":"Cluster-capability probes ('what EC policies exist') routed through an HttpFS gateway not backed by HDFS; management UIs defaulting to HttpFS; server config missing or stale after storage migration.","solutions":["Set fs.defaultFS=hdfs://<nameservice> in the HttpFS server configuration and restart","Probe capabilities via WebHDFS against the NameNode instead of the gateway","Treat this error as a hard capability signal: cache it and stop issuing EC calls to this endpoint","Verify the running server's effective config from its startup log, not just the on-disk file"],"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; GETERASURECODINGPOLICIES then returns the policy list JSON -->","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static DistributedFileSystem asDfs(FileSystem fs) {\n  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;\n}","tryCatchPattern":"try {\n  Collection<ErasureCodingPolicyInfo> ps = fs.getAllErasureCodingPolicies();\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not supported for HttpFs\")) {\n    return Collections.emptyList(); // gateway not HDFS-backed: no EC policies exist\n  }\n  throw e;\n}","preventionTips":["Use this list call as a capability probe; empty-on-unsupported keeps UIs alive","Cache the capability result per endpoint instead of re-probing every request","Expose EC management only through HDFS-backed endpoints (WebHDFS on the NameNode)"],"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"}