{"record":{"id":"a2d69ad33cd38479","repo":"quarkusio/quarkus","slug":"failed-to-collect-project-s-classes-in-a-temporary","errorCode":null,"errorMessage":"Failed to collect project's classes in a temporary dir","messagePattern":"Failed to collect project's classes in a temporary dir","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"error","filePath":"devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java","lineNumber":76,"sourceCode":"\n        try {\n            Path mergedClassesDir = tmpDir.toPath().resolve(\"quarkus-app-classes\" + (test ? \"-test\" : \"\"));\n\n            if (!populated) {\n                return mergedClassesDir;\n            }\n\n            if (Files.exists(mergedClassesDir)) {\n                IoUtils.recursiveDelete(mergedClassesDir);\n            }\n\n            for (Path classesDir : existingClassesDirs) {\n                IoUtils.copy(classesDir, mergedClassesDir);\n            }\n\n            return mergedClassesDir;\n        } catch (IOException e) {\n            throw new UncheckedIOException(ERROR_COLLECTING_PROJECT_CLASSES, e);\n        }\n    }\n\n}\n","sourceCodeStart":58,"sourceCodeEnd":81,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusGradleUtils.java#L58-L81","documentation":"QuarkusGradleUtils.mergeClassesDirs copies the project's compiled classes directories into a single merged temporary directory; if any IOException occurs during copying it wraps it in an UncheckedIOException with the message 'Failed to collect project's classes in a temporary dir'. This blocks dev mode because Quarkus needs one merged output directory for the application classes.","triggerScenarios":"Calling QuarkusGradleUtils.mergeClassesDirs (via merged) when creating or copying into the temporary merged-classes dir fails: missing read permissions on source classes dirs, unwritable temp directory, or file locks held by another process.","commonSituations":"Read-only or full TMPDIR (/tmp full or noexec/quota limits); two Gradle daemons or an IDE build running concurrently and holding file locks; classes directory deleted mid-build by a parallel clean; sandboxed CI environments restricting temp file creation.","solutions":["Check available disk space and write permissions on java.io.tmpdir (or the configured temp location).","Stop duplicate Gradle daemons: ./gradlew --stop, then re-run the dev-mode task.","Set the java.io.tmpdir system property to a writable directory: GRADLE_OPTS=-Djava.io.tmpdir=/path/writable.","Rebuild the project (./gradlew classes) to ensure the classes dirs exist before dev mode.","Exclude the project directory from antivirus/indexing tools that lock files during copying."],"exampleFix":"// before: full or unwritable default temp dir\n// after: point Gradle at a writable temp dir\n// in gradle.properties or environment\norg.gradle.jvmargs=-Djava.io.tmpdir=/home/user/tmp","handlingStrategy":"validation","validationCode":"// Pre-check writable temp space before running dev mode\nimport java.nio.file.*;\nPath tmp = Paths.get(System.getProperty(\"java.io.tmpdir\"));\nFiles.createTempFile(\"quarkus-check\", \".tmp\");\nif (tmp.toFile().getUsableSpace() < 100_000_000L) {\n  throw new IllegalStateException(\"Insufficient space in \" + tmp + \"; set -Djava.io.tmpdir\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  ./gradlew quarkusDev\n} catch (UncheckedIOException e) {\n  if (e.getMessage().contains(\"Failed to collect project's classes\")) {\n    // free temp space, stop extra daemons (./gradlew --stop), rerun with GRADLE_OPTS=-Djava.io.tmpdir=<writable>\n  }\n}","preventionTips":["Monitor disk space on the temp volume in CI pipelines.","Avoid running clean and dev-mode tasks concurrently on the same project.","Exclude project and temp directories from antivirus real-time scanning.","Run ./gradlew classes before dev mode to guarantee compiled outputs exist."],"tags":["gradle","io","filesystem","quarkus-dev-mode"],"backgroundTag":"temp-directory-io-failure","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"}