quarkusio/quarkus · error · ClassLoaderLimiterConsistencyException
resource listed multiple times as loaded at most once:
Error message
resource listed multiple times as loaded at most once:
What it means
Thrown by ClassLoaderLimiter.Builder.loadedAtMostOnceResource when the same resource name is registered twice as loaded-at-most-once. The limiter tracks these resources to assert each is loaded zero or one times, so duplicates would corrupt that assertion. It is a misuse of the builder API at bootstrap time.
Source
Thrown at independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java:188
* Useful to check that a resource is being loaded only once, or never.
* If there is an attempt of loading the matched resource more than once, a runtime exception will be thrown instead:
* useful for running integration tests to verify your assumptions.
* <p>
* Limitations: if the resource is being loaded using the bootstrap classloader we
* can't check it; some frameworks explicitly request using the base classloader
* for resource loading (or even use the Filesystem API), so they can't be tested via this method.
* Additionally, some frameworks will load the same resource but in different Quarkus build
* phases (which map to different classloaders); such cases will count as multiple times
* so it might not be suited to test this way.
*
* @param resourceFullName the resource name
* @return this, for method chaining.
*/
public Builder loadedAtMostOnceResource(String resourceFullName) {
Objects.requireNonNull(resourceFullName);
final boolean add = atMostOnceResources.add(resourceFullName);
if (!add)
throw new ClassLoaderLimiterConsistencyException(
"resource listed multiple times as loaded at most once: " + resourceFullName);
if (vetoedResources.contains(resourceFullName)) {
throw new ClassLoaderLimiterConsistencyException(
resourceFullName + " is being listed both as never loaded and as at most once");
}
return this;
}
/**
* When the specified resource is loaded, print a full stack trace on System out.
* This is not useful for testing, but handy to trace were a certain load is coming from,
* should you need to diagnose a failing expectation.
*
* @param resourceFullName
* @return this, for method chaining.
*/
public Builder produceStackTraceOnLoad(String resourceFullName) {
Objects.requireNonNull(resourceFullName);View on GitHub (pinned to e1c734241f)
Solutions
- Deduplicate resource names before calling the builder
- Remove one of the duplicate registrations
- Keep ownership of at-most-once registration in a single component
Example fix
// before
builder.loadedAtMostOnceResource("META-INF/services/com.foo.Service");
builder.loadedAtMostOnceResource("META-INF/services/com.foo.Service"); // throws
// after
if (resourcesSeen.add("META-INF/services/com.foo.Service")) builder.loadedAtMostOnceResource("META-INF/services/com.foo.Service"); Defensive patterns
Strategy: validation
Validate before calling
if (!atMostOnceSeen.add(name)) { /* skip */ } Prevention
- Use a Set to deduplicate at-most-once resource names
- Register each resource from exactly one component
- Review generated builder code for repeated entries
When it happens
Trigger: Calling builder.loadedAtMostOnceResource(name) twice for the same resourceFullName (Set.add returns false).
Common situations: Two integrations or generated code paths both marking the same resource (e.g. a service file) as at-most-once.
Related errors
- is being listed both as never loaded and as at most once
- never loaded class listed multiple times:
- resource listed multiple times to produce a stacktrace:
- Invalid URL:
- Failed to load steps from %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/a7b6b43a47ac399d.
Report an issue: GitHub.