quarkusio/quarkus · error · UncheckedIOException

Unable to determine the path of target/

Error message

Unable to determine the path of target/

What it means

FilerUtil.getTargetPath determines the module's target/ directory by asking the annotation-processing Filer for a dummy CLASS_OUTPUT resource and taking two parents of its URI. If the Filer throws IOException (no CLASS_OUTPUT location available) the path cannot be determined; the processor logs an error and rethrows as UncheckedIOException. This method backs yamlModelPath, so doc-model generation cannot proceed without it.

Source

Thrown at core/processor/src/main/java/io/quarkus/annotation/processor/util/FilerUtil.java:192

    public Path writeModel(String filePath, Object value) {
        Path yamlModelPath = getTargetPath().resolve(filePath);
        try {
            Files.createDirectories(yamlModelPath.getParent());
            JacksonMappers.yamlObjectWriter().writeValue(yamlModelPath.toFile(), value);

            return yamlModelPath;
        } catch (IOException e) {
            throw new IllegalStateException("Unable to write the model to: " + yamlModelPath, e);
        }
    }

    public Path getTargetPath() {
        try {
            FileObject dummyFile = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", "dummy");
            return Paths.get(dummyFile.toUri()).getParent().getParent();
        } catch (IOException e) {
            processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Unable to determine the path of target/" + e);
            throw new UncheckedIOException(e);
        }
    }

    public Optional<Path> getPomPath() {
        try {
            Path pomPath = Paths.get(processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", "dummy").toUri())
                    .getParent().getParent().getParent().resolve("pom.xml");

            if (!Files.isReadable(pomPath)) {
                return Optional.empty();
            }

            return Optional.of(pomPath.toAbsolutePath());
        } catch (IOException e) {
            return Optional.empty();
        }
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Ensure the module compiles to a normal on-disk classes output (standard Maven target/classes layout).
  2. Rebuild with the standard toolchain: ./mvnw clean install -f extensions/<name>/ rather than custom compiler invocations.
  3. Check the IOException detail in the printed message for the underlying cause (permissions, missing output dir) and fix that.
  4. If using a custom build integration, guarantee Filer.getResource(CLASS_OUTPUT, ...) resolves to a filesystem location.

Example fix

// before: custom compile with no output location
javac -proc:only -processor ...
// after: standard build so CLASS_OUTPUT exists
./mvnw install -f extensions/<name>/
Defensive patterns

Strategy: validation

Validate before calling

Path classes = Paths.get("target", "classes");
if (!Files.isDirectory(classes)) {
    throw new IllegalStateException("Compile to a standard target/classes layout first");
}

Try / catch

try {
    build();
} catch (UncheckedIOException e) {
    if (e.getMessage() != null && e.getMessage().contains("Unable to determine the path of target/")) {
        rebuildWithStandardMavenLayout();
    } else throw e;
}

Prevention

When it happens

Trigger: Called during annotation processing when StandardLocation.CLASS_OUTPUT is not resolvable — e.g. processing invoked without a normal compilation output location, unusual Filer setups, or getResource("dummy") failing due to environment/IO problems.

Common situations: Custom build setups where class output is virtual/in-memory; running the processor in non-standard toolchains or sandboxes; misconfigured output directories in the build.

Related errors


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