quarkusio/quarkus · error · RuntimeException
Buildpack build unable to determine project dir
Error message
Buildpack build unable to determine project dir
What it means
BuildpackProcessor.getPaths cannot locate the project directory when findMainSourcesRoot fails to map the build output directory back to a sources root/project root. Buildpack needs the project root to locate buildpack configuration files, so the build aborts with a RuntimeException.
Source
Thrown at extensions/container-image/container-image-buildpack/deployment/src/main/java/io/quarkus/container/image/buildpack/deployment/BuildpackProcessor.java:149
}
log.info("Starting (local) container image build for native binary using buildpack.");
String targetImageName = runBuildpackBuild(buildpackConfig, containerImage, containerImageConfig, buildContainerImage,
pushContainerImage,
outputTarget, true /* isNative */);
artifactResultProducer.produce(new ArtifactResultBuildItem(null, "native-container",
Collections.singletonMap("container-image", targetImageName)));
containerImageBuilder.produce(new ContainerImageBuilderBuildItem(BUILDPACK));
}
private Map<ProjectDirs, Path> getPaths(OutputTargetBuildItem outputTarget) {
Path targetDirectory = outputTarget.getOutputDirectory();
Map.Entry<Path, Path> mainSourcesRoot = findMainSourcesRoot(targetDirectory);
if (mainSourcesRoot == null) {
throw new RuntimeException("Buildpack build unable to determine project dir");
}
Path sourceRoot = mainSourcesRoot.getKey();
Path projectRoot = mainSourcesRoot.getValue();
if (!projectRoot.toFile().exists() || !sourceRoot.toFile().exists()) {
throw new RuntimeException("Buildpack build unable to verify project dir");
}
Map<ProjectDirs, Path> result = new HashMap<>();
result.put(ProjectDirs.ROOT, projectRoot);
result.put(ProjectDirs.SOURCE, sourceRoot);
result.put(ProjectDirs.TARGET, targetDirectory);
return result;
}
private String runBuildpackBuild(BuildpackConfig buildpackConfig,
ContainerImageInfoBuildItem containerImage,
ContainerImageConfig containerImageConfig,
boolean buildContainerImage,View on GitHub (pinned to e1c734241f)
Solutions
- Build with the standard Maven/Gradle target directory layout
- Check findMainSourcesRoot expectations: output dir must be under a module containing a source root (src/main/...)
- Ensure the project is built in place so sources and target directories are colocated
Example fix
// before ./mvnw package -Dquarkus.package.output-directory=/tmp/out -Dquarkus.container-image.build=true // after ./mvnw package -Dquarkus.container-image.build=true
Defensive patterns
Strategy: validation
Validate before calling
Path target = Path.of("target");
if (!Files.isDirectory(target.resolve("..", "src", "main"))) {
throw new IllegalStateException("build must run from a standard project layout");
} Try / catch
try {
imageBuild();
} catch (RuntimeException e) {
if (e.getMessage().contains("unable to determine project dir")) {
// rerun from the standard project checkout
} else { throw e; }
} Prevention
- Don't override the build output directory when building container images
- Run image builds from the project root with the standard Maven/Gradle layout
When it happens
Trigger: The outputTarget output directory is not inside a recognizable project sources tree (e.g. custom output directory, unusual project layout, or build run outside a standard Maven/Gradle structure).
Common situations: Overriding the build output directory; multi-module projects with non-standard layouts; running the image build from a detached workspace where sources don't exist.
Related errors
- The native binary produced by the build is not a Linux binar
- Buildpack build unable to verify project dir
- Buildpack build failed
- Could not find builder image '${effectiveBuilderImage}' loca
- Task: %s requires extensions: %s. To add the extensions to t
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/1850e10453df2ec7.
Report an issue: GitHub.