quarkusio/quarkus · error · RuntimeException

Error reading stream.

Error message

Error reading stream.

What it means

OutputFilter reads a process/log stream line by line; if reading throws an IOException other than the tolerated 'Stream closed' case, it wraps it in a RuntimeException 'Error reading stream.' This usually indicates the underlying stream broke unexpectedly rather than a normal end-of-stream.

Source

Thrown at core/deployment/src/main/java/io/quarkus/deployment/OutputFilter.java:29

public class OutputFilter implements Function<InputStream, Runnable> {
    private final StringBuilder builder = new StringBuilder();
    private static final Logger log = Logger.getLogger(OutputFilter.class);

    @Override
    public Runnable apply(InputStream is) {
        return () -> {

            try (InputStreamReader isr = new InputStreamReader(is);
                    BufferedReader reader = new BufferedReader(isr)) {

                for (String line = reader.readLine(); line != null; line = reader.readLine()) {
                    builder.append(line);
                }
            } catch (IOException e) {
                if (e.getMessage().contains("Stream closed")) {
                    log.warn("Stream is closed, ignoring and trying to continue");
                } else {
                    throw new RuntimeException("Error reading stream.", e);
                }
            }
        };
    }

    public String getOutput() {
        return builder.toString();
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Investigate the cause (the wrapped IOException is attached) — check the child process logs and exit code.
  2. Ensure the process whose output is filtered is not being forcibly killed before it finishes.
  3. Catch the RuntimeException around the augmentation/run call and handle it if reading child output is best-effort in your tooling.

Example fix

null
Defensive patterns

Strategy: try-catch

Try / catch

try {
    augmentor.run();
} catch (RuntimeException e) {
    if ("Error reading stream.".equals(e.getMessage())) {
        log.warn("Child output stream broke; cause: " + e.getCause(), e);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: The monitored process is killed abruptly or the pipe is closed mid-read; an IOException occurs while BufferedReader.readLine() whose message does not contain 'Stream closed'.

Common situations: Forked build/test processes dying unexpectedly; platform pipe breakage in CI; a child process terminating while Quarkus still reads its output.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/291bc8c69af087c3. Report an issue: GitHub.