apache/hadoop · error · IOException
Expecting a line not the end of stream
Error message
Expecting a line not the end of stream
What it means
Error "Expecting a line not the end of stream" thrown in apache/hadoop.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java:79
void startRefresh() throws IOException {
run();
}
@Override
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))View on GitHub (pinned to 2add963021)
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.
When it happens
Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/DU.java:79 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/549f490014c7aec5.
Report an issue: GitHub.