{"record":{"id":"342f72c842ed5e50","repo":"apache/hadoop","slug":"geterasurecodecodecs-is-not-supported-for-httpfs-o","errorCode":null,"errorMessage":"getErasureCodeCodecs is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration","messagePattern":"getErasureCodeCodecs 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":2391,"sourceCode":"\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\n    @Override\n    public Map execute(FileSystem fs) throws IOException {\n      Map<String, Map<String, String>> ecCodecs = new HashMap<>();\n      if (fs instanceof DistributedFileSystem) {\n        DistributedFileSystem dfs = (DistributedFileSystem) fs;\n        ecCodecs.put(\"ErasureCodingCodecs\", dfs.getAllErasureCodingCodecs());\n      } else {\n        throw new UnsupportedOperationException(\"getErasureCodeCodecs is \" +\n            \"not supported for HttpFs on \" + fs.getClass() +\n            \". Please check your fs.defaultFS configuration\");\n      }\n      HttpFSServerWebApp.get().getMetrics().incrOpsECCodecs();\n      return ecCodecs;\n    }\n  }\n\n  /**\n   * Executor that performs a FSGetTrashRoots operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSGetTrashRoots\n      implements FileSystemAccess.FileSystemExecutor<Map> {\n    final private boolean allUsers;\n\n    public FSGetTrashRoots(boolean allUsers) {\n      this.allUsers = allUsers;","sourceCodeStart":2373,"sourceCodeEnd":2409,"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#L2373-L2409","documentation":"HttpFS's GETECCODECS executor calls DistributedFileSystem.getAllErasureCodingCodecs(), an HDFS-only API. The executor runs against whatever FileSystem the HttpFS server's fs.defaultFS resolves to; if that instance is not a DistributedFileSystem (e.g. LocalFileSystem, WebHdfsFileSystem, S3AFileSystem), it throws UnsupportedOperationException, embedding the actual class name of {0} so you can see what backend was really used.","triggerScenarios":"An HTTP GET request to HttpFS/WebHDFS with op=GETECCODECS (e.g. GET http://host:14000/webhdfs/v1/?op=GETECCODECS&user.name=alice) when the HttpFS server's core-site fs.defaultFS is file:///, s3a://, adls://, or another WebHDFS/HttpFS URL (chained proxies). Any non-HDFS scheme produces this exact throw.","commonSituations":"fs.defaultFS left as the default file:/// in test or sandbox deployments; HttpFS fronting an object store instead of HDFS; HttpFS chained in front of WebHDFS (the client FileSystem becomes WebHdfsFileSystem, not DistributedFileSystem); HttpFS server's conf dir missing the HDFS core-site.xml so it falls back to local.","solutions":["Set fs.defaultFS to the HDFS cluster (hdfs://namenode:8020) in the HttpFS server's configuration (its conf dir or httpfs-site.xml), then restart HttpFS.","Read the class name in the message ({0}) to identify which FileSystem was actually instantiated — e.g. 'WebHdfsFileSystem' means HttpFS is pointing at another HTTP endpoint, 'LocalFileSystem' means file:/// was used.","If the backend really is not HDFS, stop sending op=GETECCODECS through HttpFS and query erasure-coding codecs with the native client for that filesystem."],"exampleFix":"<!-- before: HttpFS server core-site.xml -->\n<property><name>fs.defaultFS</name><value>file:///</value></property>\n\n<!-- after -->\n<property><name>fs.defaultFS</name><value>hdfs://namenode.example.com:8020</value></property>","handlingStrategy":"type-guard","validationCode":"// server-side / embedder: verify backend before exposing the op\nFileSystem fs = FileSystem.get(conf);\nif (!(fs instanceof DistributedFileSystem)) {\n  throw new IllegalStateException(\"GETECCODECS requires HDFS; fs.defaultFS resolves to \" + fs.getUri());\n}","typeGuard":"static boolean supportsEcCodecs(FileSystem fs) {\n  return fs instanceof DistributedFileSystem;\n}","tryCatchPattern":"try {\n  Map codecs = httpFsClient.getErasureCodingCodecs();\n} catch (UnsupportedOperationException e) {\n  // message names the actual FileSystem class; fix server fs.defaultFS, not client code\n  LOG.warn(\"HttpFS backend does not support EC codecs: {}\", e.getMessage());\n}","preventionTips":["Set fs.defaultFS explicitly to hdfs:// in the HttpFS server config; never rely on the file:/// default.","Add a startup smoke check (curl op=GETECCODECS) to deployment verification.","Avoid chaining HttpFS on top of WebHDFS when HDFS-only ops are needed."],"tags":["hdfs","httpfs","webhdfs","erasure-coding","fs-defaultfs","configuration","unsupported-operation"],"backgroundTag":"unsupported-filesystem-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}