quarkusio/quarkus · error · RuntimeException

Buildpack build unable to verify project dir

Error message

Buildpack build unable to verify project dir

What it means

After resolving the project root and sources root, getPaths verifies that both directories actually exist on disk; if either is missing the build fails with a RuntimeException because buildpack cannot source files from a nonexistent project.

Source

Thrown at extensions/container-image/container-image-buildpack/deployment/src/main/java/io/quarkus/container/image/buildpack/deployment/BuildpackProcessor.java:154

                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,
            boolean pushContainerImage,
            OutputTargetBuildItem outputTarget,
            boolean isNativeBuild) {

        Map<ProjectDirs, Path> dirs = getPaths(outputTarget);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify the project source and root directories exist before running the image build
  2. Run the container-image build from the actual project checkout
  3. Fix CI to include sources (not just target artifacts) when building images
Defensive patterns

Strategy: validation

Validate before calling

Path projectRoot = Path.of(System.getProperty("user.dir"));
if (!Files.isDirectory(projectRoot.resolve("src", "main"))) {
    throw new IllegalStateException("project sources missing from workspace");
}

Try / catch

try {
    imageBuild();
} catch (RuntimeException e) {
    if (e.getMessage().contains("unable to verify project dir")) {
        // ensure sources exist in the workspace before rebuilding
    } else { throw e; }
}

Prevention

When it happens

Trigger: findMainSourcesRoot returned paths that don't exist — e.g. the build ran in a workspace where source directories were deleted/moved, or paths were computed for another filesystem (containers, CI checkouts).

Common situations: CI pipelines copying only artifacts; Docker-in-Docker builds where host paths differ; stale build caches pointing at removed directories.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/dab97eb377368ef6. Report an issue: GitHub.