quarkusio/quarkus · error · IllegalArgumentException

does not exist

Error message

 does not exist

What it means

The WorkspaceLoader constructor reads file attributes of the given currentProjectPom path. If Files.readAttributes throws IOException (path does not exist or is inaccessible), it wraps it in IllegalArgumentException(currentProjectPom + " does not exist"). Unlike the locate-based errors, here the caller supplied a path that is not present on disk at all.

Source

Thrown at independent-projects/bootstrap/maven-resolver/src/main/java/io/quarkus/bootstrap/resolver/maven/workspace/WorkspaceLoader.java:103

    private final Deque<WorkspaceModulePom> loadQueue = new ConcurrentLinkedDeque<>();
    // Map key is the normalized absolute Path to the module directory
    private final Map<Path, WorkspaceModulePom> knownModules = new ConcurrentHashMap<>();
    private final Map<GAV, Model> loadedModules = new ConcurrentHashMap<>();
    private final Consumer<WorkspaceModulePom> loadedModelProcessor;

    private final LocalWorkspace workspace = new LocalWorkspace();
    private final Path currentProjectPom;
    private volatile LocalProject currentProject;

    WorkspaceLoader(BootstrapMavenContext ctx, Path currentProjectPom, List<WorkspaceModulePom> providedModules)
            throws BootstrapMavenException {
        try {
            final BasicFileAttributes fileAttributes = Files.readAttributes(currentProjectPom, BasicFileAttributes.class);
            this.currentProjectPom = fileAttributes.isDirectory() ? locateCurrentProjectPom(currentProjectPom)
                    : currentProjectPom;
        } catch (IOException e) {
            throw new IllegalArgumentException(currentProjectPom + " does not exist", e);
        }
        boolean queueCurrentPom = true;
        if (providedModules != null) {
            // queue all the provided POMs
            for (var module : providedModules) {
                if (queueCurrentPom && this.currentProjectPom.equals(module.pom)) {
                    queueCurrentPom = false;
                }
                knownModules.put(module.getModuleDir(), module);
                loadQueue.add(module);
            }
        }

        if (queueCurrentPom) {
            WorkspaceModulePom module = new WorkspaceModulePom(this.currentProjectPom);
            knownModules.put(module.getModuleDir(), module);
            loadQueue.add(module);
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Verify the path exists before constructing: `Files.exists(Files.isReadable)` — fix the configured path to point at the actual project pom.xml or directory.
  2. Correct the system property / config that supplies the project path (typo check, absolute vs relative path).
  3. Recreate the deleted pom.xml or re-clone/restore the project directory.
  4. Catch IllegalArgumentException around loader construction and surface a clear user-facing message with the offending path.

Example fix

// before
Path pom = Path.of(System.getProperty("app.pom")); // stale value
WorkspaceLoader loader = ctx.newWorkspaceLoader(pom, ...);
// after
Path pom = Path.of(System.getProperty("app.pom"));
if (!Files.isReadable(pom)) {
    throw new IllegalArgumentException("Project pom path does not exist: " + pom);
}
WorkspaceLoader loader = ctx.newWorkspaceLoader(pom, ...);
Defensive patterns

Strategy: validation

Validate before calling

static Path requireExistingPom(Path pom) {
    if (!Files.exists(pom)) {
        throw new IllegalArgumentException("Path does not exist: " + pom);
    }
    return pom;
}

Type guard

static boolean pathExists(Path p) {
    return p != null && Files.exists(p);
}

Try / catch

try {
    WorkspaceLoader loader = ctx.newWorkspaceLoader(currentProjectPom, modules);
} catch (IllegalArgumentException e) {
    log.error("Project pom path invalid: " + e.getMessage());
}

Prevention

When it happens

Trigger: Calling new WorkspaceLoader(ctx, currentProjectPom, modules) (via BootstrapMavenContext) with a path that does not exist or is unreadable — a stale pom.xml reference, a typo in a path config, or a file deleted between path discovery and loader construction.

Common situations: A configured `quarkus` project path or system property pointing to a moved/deleted project; script passing the wrong directory; tests reusing temp dirs already cleaned up (e.g. @TempDir cleanup ordering); network-mounted path that vanished.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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