apache/hadoop · error · IOException

Illegal du output

Error message

Illegal du output

What it means

Error "Illegal du output" thrown in apache/hadoop.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java:83

    public String toString() {
      return
          "du -sk " + getDirPath() + "\n" + used.get() + "\t" + getDirPath();
    }

    @Override
    protected String[] getExecString() {
      return new String[]{"du", "-sk", getDirPath()};
    }

    @Override
    protected void parseExecResult(BufferedReader lines) throws IOException {
      String line = lines.readLine();
      if (line == null) {
        throw new IOException("Expecting a line not the end of stream");
      }
      String[] tokens = line.split("\t");
      if (tokens.length == 0) {
        throw new IOException("Illegal du output");
      }
      setUsed(Long.parseLong(tokens[0]) * 1024);
    }

  }


  public static void main(String[] args) throws Exception {
    String path = ".";
    if (args.length > 0) {
      path = args[0];
    }

    GetSpaceUsed du = new GetSpaceUsed.Builder().setPath(new File(path))
                                                .setConf(new Configuration())
                                                .build();
    String duResult = du.toString();
    System.out.println(duResult);

View on GitHub (pinned to 2add963021)

Solutions

  1. Confirm the du output format matches the expected '<size> <path>' two-column layout.
  2. Check for localized or platform-specific du output differences and parse accordingly.
  3. Verify the du command used is compatible with this platform.

When it happens

Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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