{"record":{"id":"0b0137839e952879","repo":"quarkusio/quarkus","slug":"failed-to-log-the-dependency-list-to-a-file","errorCode":null,"errorMessage":"Failed to log the dependency list to a file","messagePattern":"Failed to log the dependency list to a file","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/DependencyListMojo.java","lineNumber":151,"sourceCode":"        if (outputFile == null) {\n            log = s -> getLog().info(s);\n        } else {\n            final BufferedWriter bw;\n            try {\n                Files.createDirectories(outputFile.toPath().getParent());\n                final OpenOption[] openOptions = appendOutput && outputFile.exists()\n                        ? new OpenOption[] { StandardOpenOption.APPEND }\n                        : new OpenOption[0];\n                bw = writer = Files.newBufferedWriter(outputFile.toPath(), openOptions);\n            } catch (IOException e) {\n                throw new MojoExecutionException(\"Failed to initialize file output writer\", e);\n            }\n            log = s -> {\n                try {\n                    bw.write(s);\n                    bw.newLine();\n                } catch (IOException e) {\n                    throw new RuntimeException(\"Failed to log the dependency list to a file\", e);\n                }\n            };\n        }\n        try {\n            logDependencies(log);\n        } finally {\n            if (writer != null) {\n                try {\n                    writer.close();\n                } catch (IOException e) {\n                    getLog().debug(\"Failed to close the output file\", e);\n                }\n            }\n        }\n    }\n\n    private void logDependencies(final Consumer<String> log) throws MojoExecutionException {\n        final int parsedFlags = parseFlags();","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/DependencyListMojo.java#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-run the build after checking disk space and filesystem health","Write output to a local disk path instead of a network/mounted filesystem","If the error persists, capture to console instead of a file and investigate the environment"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure sufficient disk space and a healthy local filesystem before writing large output\njava.io.File target = new java.io.File(outputFile).getAbsoluteFile().getParentFile();\nlong usable = target.getUsableSpace();\nif (usable < 10 * 1024 * 1024) {\n    throw new IllegalStateException(\"Low disk space: \" + usable + \" bytes free on \" + target);\n}","typeGuard":null,"tryCatchPattern":"try {\n    mvn quarkus:dependency-list -DoutputFile=target/deps.txt;\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Failed to log the dependency list to a file\")) {\n        // mid-write I/O failure: check disk/filesystem health via the cause, then retry\n        e.getCause().printStackTrace();\n    }\n}","preventionTips":["Avoid writing mojo output to network or unreliable mounted filesystems","Keep enough free disk space for build outputs in CI","Don't concurrently write to or delete the same output file while the build runs"],"tags":["maven","io","file-write","build"],"backgroundTag":"file-write-io-error","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}