{"record":{"id":"549f490014c7aec5","repo":"apache/hadoop","slug":"expecting-a-line-not-the-end-of-stream","errorCode":null,"errorMessage":"Expecting a line not the end of stream","messagePattern":"Expecting a line not the end of stream","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java","lineNumber":79,"sourceCode":"    void startRefresh() throws IOException {\n      run();\n    }\n    @Override\n    public String toString() {\n      return\n          \"du -sk \" + getDirPath() + \"\\n\" + used.get() + \"\\t\" + getDirPath();\n    }\n\n    @Override\n    protected String[] getExecString() {\n      return new String[]{\"du\", \"-sk\", getDirPath()};\n    }\n\n    @Override\n    protected void parseExecResult(BufferedReader lines) throws IOException {\n      String line = lines.readLine();\n      if (line == null) {\n        throw new IOException(\"Expecting a line not the end of stream\");\n      }\n      String[] tokens = line.split(\"\\t\");\n      if (tokens.length == 0) {\n        throw new IOException(\"Illegal du output\");\n      }\n      setUsed(Long.parseLong(tokens[0]) * 1024);\n    }\n\n  }\n\n\n  public static void main(String[] args) throws Exception {\n    String path = \".\";\n    if (args.length > 0) {\n      path = args[0];\n    }\n\n    GetSpaceUsed du = new GetSpaceUsed.Builder().setPath(new File(path))","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java#L61-L97","documentation":"Error \"Expecting a line not the end of stream\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java:79 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the du command produced output; an empty stream means du failed or the path is invalid.","Check stderr of the du process for the real error.","Ensure the path being measured exists and is readable."],"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"}