quarkusio/quarkus · error · GradleException
Failed to create directories in %s
Error message
Failed to create directories in %s
What it means
QuarkusBuildDependencies.jarDependencies creates the lib/boot and lib/main directories of the dependency cache before copying Fast-Jar/legacy dependencies. If Files.createDirectories fails with IOException the task fails with this GradleException, including the target dependency directory in the message. It means the build cannot prepare its output layout, typically for environment reasons.
Source
Thrown at devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusBuildDependencies.java:147
private void jarDependencies(Path libBoot, Path libMain) {
Path depDir = depBuildDir();
if (nativeEnabled()) {
if (nativeSourcesOnly()) {
getLogger().info("Placing Quarkus application dependencies for native sources build in {}", depDir);
} else {
getLogger().info("Placing Quarkus application dependencies for native build in {}", depDir);
}
} else {
getLogger().info("Placing Quarkus application dependencies for JAR type {} in {}", jarType(),
depDir);
}
try {
Files.createDirectories(libBoot);
Files.createDirectories(libMain);
} catch (IOException e) {
throw new GradleException(String.format("Failed to create directories in %s", depDir), e);
}
ApplicationModel appModel = resolveAppModelForBuild();
SmallRyeConfig config = effectiveProvider()
.buildEffectiveConfiguration(appModel, new HashMap<>())
.getConfig();
// see https://quarkus.io/guides/class-loading-reference#configuring-class-loading
Set<ArtifactKey> removedArtifacts = config.getOptionalValue(CLASS_LOADING_REMOVED_ARTIFACTS, String.class)
.map(QuarkusBuildDependencies::dependenciesListToArtifactKeySet)
.orElse(Collections.emptySet());
getLogger().info("Removed artifacts: {}",
config.getOptionalValue(CLASS_LOADING_REMOVED_ARTIFACTS, String.class).orElse("(none)"));
String parentFirstArtifactsProp = config.getOptionalValue(CLASS_LOADING_PARENT_FIRST_ARTIFACTS, String.class)
.orElse("");
Set<ArtifactKey> parentFirstArtifacts = dependenciesListToArtifactKeySet(parentFirstArtifactsProp);
getLogger().info("parent first artifacts: {}",View on GitHub (pinned to e1c734241f)
Solutions
- Inspect the depDir path from the message; if 'boot'/'main' exist as files, delete them and rebuild
- Fix permissions: chown/chmod the build output directory so the current user can write
- Check disk space and that the volume is writable
- Run ./gradlew clean (or delete the dependency directory manually) and rebuild
Example fix
// before: depDir/lib/main exists as a leftover file // after (shell): rm -rf build/quarkus-build/dependencies # path from the error message ./gradlew quarkusBuild
Defensive patterns
Strategy: validation
Validate before calling
File depDir = new File("build/quarkus-build/dependencies");
if (depDir.isFile()) throw new IllegalStateException(depDir + " is a file; delete it before building");
if (depDir.exists() && !depDir.canWrite()) throw new IllegalStateException(depDir + " not writable"); Type guard
boolean isWritableDir(File f) {
return !f.exists() || (f.isDirectory() && f.canWrite());
} Try / catch
try {
./gradlew quarkusBuild
} catch (GradleException e) {
if (e.message?.startsWith("Failed to create directories")) {
fixPermissionsOrDelete(e.message.extractPath()); retry();
} else { throw e; }
} Prevention
- Keep build output directories out of read-only mounts
- Don't mix root-owned and user-owned files in the same workspace
- Monitor disk space on CI runners
- Delete stale quarkus-build directories after crashes
When it happens
Trigger: Files.createDirectories(libBoot) or Files.createDirectories(libMain) throws IOException — the depDir path exists as a regular file, a parent is read-only, or the path is too long/invalid.
Common situations: A file named 'boot' or 'main' left over from a previous broken build inside the dependency dir; output directory on a read-only volume or full disk; permissions changed by running a previous build as root (CI cache).
Related errors
- Failed to load extension description + path
- Failed to copy %s to %s
- Failed to load + pomPropsPath + from the classpath
- Failed to collect project's classes in a temporary dir
- Failed to write Quarkus build configuration settings
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/c577ed476af67ebd.
Report an issue: GitHub.