quarkusio/quarkus · error · RuntimeException

Failed to log the dependency list to a file

Error message

Failed to log the dependency list to a file

What it means

When writing the dependency list to a file, DependencyListMojo installs a logging lambda that writes each line via BufferedWriter. If bw.write or bw.newLine throws IOException during logging, it is wrapped in a RuntimeException 'Failed to log the dependency list to a file'. Unlike the init error, this surfaces mid-write after the writer was successfully opened.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/DependencyListMojo.java:151

        if (outputFile == null) {
            log = s -> getLog().info(s);
        } else {
            final BufferedWriter bw;
            try {
                Files.createDirectories(outputFile.toPath().getParent());
                final OpenOption[] openOptions = appendOutput && outputFile.exists()
                        ? new OpenOption[] { StandardOpenOption.APPEND }
                        : new OpenOption[0];
                bw = writer = Files.newBufferedWriter(outputFile.toPath(), openOptions);
            } catch (IOException e) {
                throw new MojoExecutionException("Failed to initialize file output writer", e);
            }
            log = s -> {
                try {
                    bw.write(s);
                    bw.newLine();
                } catch (IOException e) {
                    throw new RuntimeException("Failed to log the dependency list to a file", e);
                }
            };
        }
        try {
            logDependencies(log);
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    getLog().debug("Failed to close the output file", e);
                }
            }
        }
    }

    private void logDependencies(final Consumer<String> log) throws MojoExecutionException {
        final int parsedFlags = parseFlags();

View on GitHub (pinned to e1c734241f)

Solutions

  1. Re-run the build after checking disk space and filesystem health
  2. Write output to a local disk path instead of a network/mounted filesystem
  3. If the error persists, capture to console instead of a file and investigate the environment
Defensive patterns

Strategy: try-catch

Validate before calling

// Ensure sufficient disk space and a healthy local filesystem before writing large output
java.io.File target = new java.io.File(outputFile).getAbsoluteFile().getParentFile();
long usable = target.getUsableSpace();
if (usable < 10 * 1024 * 1024) {
    throw new IllegalStateException("Low disk space: " + usable + " bytes free on " + target);
}

Try / catch

try {
    mvn quarkus:dependency-list -DoutputFile=target/deps.txt;
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("Failed to log the dependency list to a file")) {
        // mid-write I/O failure: check disk/filesystem health via the cause, then retry
        e.getCause().printStackTrace();
    }
}

Prevention

When it happens

Trigger: Executing the mojo with file output where an IOException occurs while writing lines — typically a closed/broken writer, disk full, or I/O interruption during logDependencies execution.

Common situations: Disk becoming full during a large dependency list; the underlying stream closed unexpectedly (e.g. by concurrent code or JVM shutdown); NFS/network filesystem failures on mounted CI volumes.

Related errors


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