{"record":{"id":"2c85608010a93520","repo":"apache/hadoop","slug":"top-limit-input-should-be-a-positive-numeric-value","errorCode":null,"errorMessage":"Top limit input should be a positive numeric value","messagePattern":"Top limit input should be a positive numeric value","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java","lineNumber":529,"sourceCode":"      outputLine = String.format(\n          \"No top limit specified, using default top value %d.\",\n          getDefaultTop());\n      LOG.info(outputLine);\n      result.appendln(outputLine);\n      nodes = getDefaultTop();\n    } else {\n      try {\n        nodes = Integer.parseInt(topVal);\n      } catch (NumberFormatException nfe) {\n        outputLine = String.format(\n            \"Top limit input is not numeric, using default top value %d.\",\n            getDefaultTop());\n        LOG.info(outputLine);\n        result.appendln(outputLine);\n        nodes = getDefaultTop();\n      }\n      if (nodes <= 0) {\n        throw new IllegalArgumentException(\n            \"Top limit input should be a positive numeric value\");\n      }\n    }\n\n    return Math.min(nodes, cluster.getNodes().size());\n  }\n\n  /**\n   * Reads the Physical path of the disks we are balancing. This is needed to\n   * make the disk balancer human friendly and not used in balancing.\n   *\n   * @param node - Disk Balancer Node.\n   */\n  protected void populatePathNames(\n      DiskBalancerDataNode node) throws IOException {\n    // if the cluster is a local file system, there is no need to\n    // invoke rpc call to dataNode.\n    if (getClusterURI().getScheme().startsWith(\"file\")) {","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java#L511-L547","documentation":"Error \"Top limit input should be a positive numeric value\" thrown in apache/hadoop.","triggerScenarios":"DiskBalancer top command when the -top limit argument is not a positive number.","commonSituations":"See trigger scenarios.","solutions":["Pass a positive integer for the top limit option.","Remove the option to use the default top value."],"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"}