{"record":{"id":"92fe4e2eda055351","repo":"spring-projects/spring-boot","slug":"failed-to-create","errorCode":null,"errorMessage":"Failed to create {}","messagePattern":"Failed to create (.+?)","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java","lineNumber":143,"sourceCode":"\t\tthis.includeDefaultLoader = includeDefaultLoader;\n\t\tthis.jarmodeToolsLocation = jarmodeToolsLocation;\n\t\tthis.requiresUnpack = requiresUnpack;\n\t\tthis.exclusions = exclusions;\n\t\tthis.librarySpec = librarySpec;\n\t\tthis.compressionResolver = compressionResolver;\n\t\tthis.encoding = encoding;\n\t\tthis.resolvedDependencies = resolvedDependencies;\n\t\tthis.layerResolver = layerResolver;\n\t}\n\n\t@Override\n\tpublic WorkResult execute(CopyActionProcessingStream copyActions) {\n\t\ttry {\n\t\t\twriteArchive(copyActions);\n\t\t\treturn WorkResults.didWork(true);\n\t\t}\n\t\tcatch (IOException ex) {\n\t\t\tthrow new GradleException(\"Failed to create \" + this.output, ex);\n\t\t}\n\t}\n\n\tprivate void writeArchive(CopyActionProcessingStream copyActions) throws IOException {\n\t\tOutputStream output = new FileOutputStream(this.output);\n\t\ttry {\n\t\t\twriteArchive(copyActions, output);\n\t\t}\n\t\tfinally {\n\t\t\tcloseQuietly(output);\n\t\t}\n\t}\n\n\tprivate void writeArchive(CopyActionProcessingStream copyActions, OutputStream output) throws IOException {\n\t\tZipArchiveOutputStream zipOutput = new ZipArchiveOutputStream(output);\n\t\ttry {\n\t\t\tsetEncodingIfNecessary(zipOutput);\n\t\t\tProcessor processor = new Processor(zipOutput);","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/spring-projects/spring-boot/blob/270dfe353fb830fd69b823a8a859287ff103854b/build-plugin/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/tasks/bundling/BootZipCopyAction.java#L125-L161","documentation":"Thrown by BootZipCopyAction.execute when writeArchive(copyActions) throws an IOException. This is the top-level catch around the entire archive-writing loop that creates the output boot JAR/WAR/zip. The message names this.output (the target archive File). Any I/O failure during the creation of the archive file bubbles up here.","triggerScenarios":"Any IOException while creating the output archive: cannot open FileOutputStream(this.output) (permissions, path does not exist, file is locked), disk full during write, or the output stream is closed unexpectedly.","commonSituations":"The output directory does not exist or is not writable. Another process (IDE, file watcher, previous daemon) holds a lock on the output file. Disk full. Building into a network-mounted directory that drops. Antivirus scanning locks the file mid-write.","solutions":["Run 'gradle clean' to remove stale outputs, then rebuild.","Verify the build output directory (build/libs) exists and is writable: 'ls -la build/libs' and check permissions.","Close IDEs or file-locking tools that may hold the output JAR, or add the build directory to their exclusion lists.","Check available disk space: 'df -h .'","Run with '--no-daemon' to rule out a daemon holding a file lock."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check output writability before the build.\nFile outDir = new File(project.buildDir, \"libs\");\nif (!outDir.exists() && !outDir.mkdirs()) {\n    throw new GradleException(\"Cannot create output dir: \" + outDir);\n}\nif (!outDir.canWrite()) {\n    throw new GradleException(\"Output dir not writable: \" + outDir);\n}","typeGuard":null,"tryCatchPattern":"// Catch GradleException around the bootJar/bootWar task and inspect the cause.\ntry {\n    project.getTasks().named(\"bootJar\").get().copy();\n} catch (GradleException ex) {\n    if (ex.getCause() instanceof IOException) {\n        // handle I/O: disk full, permissions, lock\n    }\n    throw ex;\n}","preventionTips":["Run 'gradle clean' to remove stale/locked outputs.","Ensure the build directory is on a local writable filesystem.","Close IDEs/tools that may lock the output JAR, or exclude the build dir from them.","Check disk space before large builds."],"tags":["gradle","io","boot-archive","filesystem","zip","disk-space"],"backgroundTag":null,"analyzedSha":"270dfe353fb830fd69b823a8a859287ff103854b","analyzedAt":"2026-08-11T19:42:06.541Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}