quarkusio/quarkus · error · RuntimeException
Failed to log the dependency tree to a file
Error message
Failed to log the dependency tree to a file
What it means
DependencyTreeMojo writes the dependency tree output through a consumer lambda that wraps a BufferedWriter. If writing a line to the target file throws an IOException, the lambda wraps it in a RuntimeException with this message. The goal was asked to write the tree to a file but the file could not be written.
Source
Thrown at devtools/maven/src/main/java/io/quarkus/maven/DependencyTreeMojo.java:118
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 tree to a file", e);
}
};
}
try {
logTree(log);
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
getLog().debug("Failed to close the output file", e);
}
}
}
}
private void logTree(final Consumer<String> log) throws MojoExecutionException {
log.accept("Quarkus application " + mode.toUpperCase() + " mode build dependency tree:");View on GitHub (pinned to e1c734241f)
Solutions
- Check that the directory containing the output file exists and is writable (create it with mkdir -p / chmod).
- Close any process holding the output file open, or choose a different output file path.
- Free disk space if the filesystem is full.
- Run the goal from a directory where the current user has write permissions instead of a system location.
Example fix
// before mvn quarkus:dependency-tree -DoutputFile=/proc/out.txt // after mkdir -p target/reports && mvn quarkus:dependency-tree -DoutputFile=target/reports/deptree.txt
Defensive patterns
Strategy: validation
Validate before calling
// before running: ensure output location is writable
Path out = Path.of("target/deptree.txt");
Files.createDirectories(out.getParent());
if (!Files.isWritable(out.getParent())) throw new IllegalStateException("Output dir not writable: " + out.getParent()); Prevention
- Always write tool output under target/ or another known-writable directory.
- Ensure the parent directory exists before running the goal.
- Avoid holding the output file open in other processes during builds.
- Monitor CI agents for full disks.
When it happens
Trigger: Running `mvn quarkus:dependency-tree` where the log consumer writes to a file whose path is unwritable, the parent directory does not exist, the file is locked by another process, or the disk is full.
Common situations: Output file placed in a read-only directory; parent directory not created; another process (tail, editor, previous crashed build) holds a lock on the file; full disk on CI; Windows file handle still open from a prior run.
Understand the failure class
Background: "Permission denied" / "Failed to write" file errors: why a library can't write its files to disk (EACCES, EPERM, ENOSPC) and how to fix them — this error's family across 43 libraries.
Related errors
- Failed to initialize file output writer
- Failed to log the dependency list to a file
- Failed to initialize file output writer
- Unable to write quarkus native image agent caller filter to
- Failed to read ${compareFile}
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/dfbbd1a5b0eb9cc2.
Report an issue: GitHub.