{"record":{"id":"0caba2fb71623daa","repo":"apache/hadoop","slug":"print-network-topology-failed","errorCode":null,"errorMessage":"Print network topology failed. {}","messagePattern":"Print network topology failed\\. (.+?)","errorType":"http","errorClass":"IOException","httpStatus":410,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NetworkTopologyServlet.java","lineNumber":79,"sourceCode":"    if (FORMAT_TEXT.equals(format)) {\n      response.setContentType(\"text/plain; charset=UTF-8\");\n    } else if (FORMAT_JSON.equals(format)) {\n      response.setContentType(\"application/json; charset=UTF-8\");\n    }\n\n    NameNode nn = NameNodeHttpServer.getNameNodeFromContext(context);\n    BlockManager bm = nn.getNamesystem().getBlockManager();\n    List<Node> leaves = bm.getDatanodeManager().getNetworkTopology()\n        .getLeaves(NodeBase.ROOT);\n\n    try (PrintStream out = new PrintStream(\n            response.getOutputStream(), false, \"UTF-8\")) {\n      printTopology(out, leaves, format);\n    } catch (Throwable t) {\n      String errMsg = \"Print network topology failed. \"\n              + StringUtils.stringifyException(t);\n      response.sendError(HttpServletResponse.SC_GONE, errMsg);\n      throw new IOException(errMsg);\n    } finally {\n      response.getOutputStream().close();\n    }\n  }\n\n  /**\n   * Display each rack and the nodes assigned to that rack, as determined\n   * by the NameNode, in a hierarchical manner.  The nodes and racks are\n   * sorted alphabetically.\n   *\n   * @param stream print stream\n   * @param leaves leaves nodes under base scope\n   * @param format the response format\n   */\n  protected void printTopology(PrintStream stream, List<Node> leaves,\n      String format) throws BadFormatException, IOException {\n    if (leaves.isEmpty()) {\n      stream.print(\"No DataNodes\");","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NetworkTopologyServlet.java#L61-L97","documentation":"Error \"Print network topology failed. {}\" thrown in apache/hadoop.","triggerScenarios":"The /topology or printTopology servlet fails while rendering the cluster network topology.","commonSituations":"A broken net topology script or dfs.networkscript configuration causing topology resolution failure.","solutions":["Check NameNode logs for the topology error detail and verify the network topology (script or table) configuration is valid."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}