quarkusio/quarkus · error · IllegalStateException

Failed to cache a new instance of io.quarkus.maven.QuarkusMa

Error message

Failed to cache a new instance of io.quarkus.maven.QuarkusMavenAppBootstrap

What it means

QuarkusBootstrapProvider caches QuarkusMavenAppBootstrap instances in a LoadingCache keyed by project/bootstrap id. If cache.get() throws ExecutionException while creating the bootstrap, this IllegalStateException is thrown.

Source

Thrown at devtools/maven/src/main/java/io/quarkus/maven/QuarkusBootstrapProvider.java:189

        return bootstrapId == null ? moduleKey.toGacString() : moduleKey.toGacString() + "-" + bootstrapId;
    }

    @Deprecated(forRemoval = true)
    public RepositorySystem repositorySystem() {
        return workspaceProvider.getRepositorySystem();
    }

    @Deprecated(forRemoval = true)
    public RemoteRepositoryManager remoteRepositoryManager() {
        return remoteRepoManager;
    }

    public QuarkusMavenAppBootstrap bootstrapper(QuarkusBootstrapMojo mojo) {
        try {
            return appBootstrapProviders.get(getBootstrapProviderId(mojo.projectId(), mojo.bootstrapId()),
                    QuarkusMavenAppBootstrap::new);
        } catch (ExecutionException e) {
            throw new IllegalStateException("Failed to cache a new instance of " + QuarkusMavenAppBootstrap.class.getName(),
                    e);
        }
    }

    public CuratedApplication bootstrapApplication(QuarkusBootstrapMojo mojo, LaunchMode mode)
            throws MojoExecutionException {
        return bootstrapApplication(mojo, mode, null);
    }

    public CuratedApplication bootstrapApplication(QuarkusBootstrapMojo mojo, LaunchMode mode,
            Consumer<QuarkusBootstrap.Builder> builderCustomizer) throws MojoExecutionException {
        return bootstrapper(mojo).bootstrapApplication(mojo, mode, builderCustomizer);
    }

    public void closeApplication(QuarkusBootstrapMojo mojo, LaunchMode mode) {
        bootstrapper(mojo).closeApplication(mode);
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the cause chain of the ExecutionException — the real error is inside it
  2. Run `mvn clean` and retry to clear stale build state
  3. Avoid running multiple Maven builds of the same project concurrently
  4. Refresh dependencies with -U if resolution errors are in the cause
  5. Update quarkus-maven-plugin to the latest patch version if a bootstrap bug is involved

Example fix

// before
mvn quarkus:dev &  mvn quarkus:dev  # two concurrent dev runs
// after
mvn quarkus:dev  # single invocation per project workspace
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure no concurrent build of the same project and repo is healthy
if (Files.exists(Path.of("target"))) { /* run mvn clean if previous run failed */ }

Try / catch

try {
    // any quarkus mojo bootstrap
} catch (IllegalStateException e) {
    if (e.getMessage().contains("Failed to cache")) {
        Throwable root = e; while (root.getCause() != null) root = root.getCause();
        log.error("Bootstrap creation failed: " + root);
    }
}

Prevention

When it happens

Trigger: Any Quarkus Maven goal (build, dev, test, package) bootstrapping the application when the underlying cache loader itself fails — typically nested initialization errors surfaced as ExecutionException.

Common situations: Concurrent Maven executions colliding on the same cache; corrupted maven repo state during bootstrap; classloading problems in the bootstrap initialization; earlier goal failure leaving inconsistent state.

Related errors


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