apache/hadoop · error · DiskBalancerException

INVALID_HOST_FILE_PATH

INVALID_HOST_FILE_PATH

Error message

The input host file path '%s' is not a valid path. Please make sure the host file exists.

What it means

Input validation in Command.getNodeList for diskbalancer CLI: the -node argument looked like a file:// URL but the referenced host file raised NoSuchFileException when read, so the node list is unavailable and the command aborts.

Solutions

  1. Verify the host file path exists and is readable; correct the path argument.
  2. Create the host file with one node per line before running the diskbalancer command.
Defensive patterns

Strategy: validation

When it happens

Trigger: DiskBalancer command with a host file path argument that does not exist or is not a regular file.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/5bad9baf3f25e861. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/diskbalancer/command/Command.java:282

  protected Set<String> getNodeList(String listArg) throws IOException {
    URL listURL;
    String nodeData;
    Set<String> resultSet = new TreeSet<>();

    if ((listArg == null) || listArg.isEmpty()) {
      return resultSet;
    }

    if (listArg.startsWith("file://")) {
      listURL = new URL(listArg);
      try {
        HostsFileReader.readFileToSet("include",
            Paths.get(listURL.getPath()).toString(), resultSet);
      } catch (NoSuchFileException e) {
        String warnMsg = String
            .format("The input host file path '%s' is not a valid path. "
                + "Please make sure the host file exists.", listArg);
        throw new DiskBalancerException(warnMsg,
            DiskBalancerException.Result.INVALID_HOST_FILE_PATH);
      }
    } else {
      nodeData = listArg;
      String[] nodes = nodeData.split(",");

      if (nodes.length == 0) {
        String warnMsg = "The number of input nodes is 0. "
            + "Please input the valid nodes.";
        throw new DiskBalancerException(warnMsg,
            DiskBalancerException.Result.INVALID_NODE);
      }

      Collections.addAll(resultSet, nodes);
    }

    return resultSet;
  }

View on GitHub (pinned to 2add963021)