{"record":{"id":"14b9999d68a6560a","repo":"apache/hadoop","slug":"getserverdefaults-is-not-supported-for-httpfs-on","errorCode":null,"errorMessage":"getServerDefaults is not supported for HttpFs on {0}. Please check your fs.defaultFS configuration","messagePattern":"getServerDefaults 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":2061,"sourceCode":"     * Creates a getServerDefaults executor.\n     */\n    public FSGetServerDefaults() {\n    }\n\n    /**\n     * Executes the filesystem operation.\n     * @param fs filesystem instance to use.\n     * @return A JSON string.\n     * @throws IOException thrown if an IO error occurred.\n     */\n    @Override\n    public String execute(FileSystem fs) throws IOException {\n      FsServerDefaults sds = null;\n      if (fs instanceof DistributedFileSystem) {\n        DistributedFileSystem dfs = (DistributedFileSystem) fs;\n        sds = dfs.getServerDefaults();\n      } else {\n        throw new UnsupportedOperationException(\"getServerDefaults is \"\n            + \"not supported for HttpFs on \" + fs.getClass()\n            + \". Please check your fs.defaultFS configuration\");\n      }\n      return JsonUtil.toJsonString(sds);\n    }\n  }\n\n  /**\n   * Executor that performs a check access operation.\n   */\n  @InterfaceAudience.Private\n  public static class FSAccess\n      implements FileSystemAccess.FileSystemExecutor<Void> {\n\n    private Path path;\n    private FsAction mode;\n\n    /**","sourceCodeStart":2043,"sourceCodeEnd":2079,"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#L2043-L2079","documentation":"FSOperations.FSGetServerDefaults.execute() answers GETSERVERDEFAULTS from DistributedFileSystem.getServerDefaults(); the executor deliberately refuses to fall back to the generic FileSystem.getServerDefaults() and throws UnsupportedOperationException when the HttpFS backing filesystem is not HDFS (HTTP 400 at the REST layer). The intent is parity with WebHDFS, which only exposes DFS server defaults.","triggerScenarios":"Client sends op=GETSERVERDEFAULTS via webhdfs:// against HttpFS backed by file:/// or an object store; tools probing block-size/replication defaults through the gateway.","commonSituations":"Clients reading fs server defaults (block size, replication, write buffer) through an HttpFS URL; HttpFS server installed without HDFS config; gateway repurposed for non-HDFS storage.","solutions":["Configure the HttpFS server's fs.defaultFS to the HDFS nameservice and restart","Read defaults from the client-side configuration (conf.getLongBytes(\"dfs.blocksize\", ...)) when the backing store is intentionally non-HDFS","Use WebHDFS against the NameNode for authoritative server defaults","Check the loaded httpfs-site.xml, not just core-site defaults on the host"],"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 so GETSERVERDEFAULTS returns FsServerDefaults JSON -->","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"static DistributedFileSystem asDfs(FileSystem fs) {\n  return fs instanceof DistributedFileSystem ? (DistributedFileSystem) fs : null;\n}","tryCatchPattern":"try {\n  FsServerDefaults d = fs.getServerDefaults();\n} catch (IOException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not supported for HttpFs\")) {\n    // fall back to client-side defaults when the gateway is not HDFS-backed\n    return new FsServerDefaultsBuilder(conf).get();\n  }\n  throw e;\n}","preventionTips":["Use this op as the cheap capability probe: GETSERVERDEFAULTS failing with 'not supported for HttpFs' marks the gateway non-HDFS","Cache server defaults at startup instead of fetching per operation","Prefer WebHDFS on the NameNode for authoritative defaults"],"tags":["httpfs","webhdfs","server-defaults","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"}