quarkusio/quarkus · error · ClassLoaderLimiterConsistencyException

resource listed multiple times as never loaded:

Error message

resource listed multiple times as never loaded: 

What it means

QuarkusBootstrap's ClassLoaderLimiter.Builder.neverLoadedResource throws ClassLoaderLimiterConsistencyException when the same resource is registered twice as never loaded. The internal vetoedResources set is used to detect duplicates and treats double registration as a configuration bug in the limiter setup itself.

Source

Thrown at independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java:111

        }

        /**
         * List a resource name as one that you don't expect to be loaded ever.
         * If there is an attempt of loading the matched resource, 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.
         *
         * @param resourceFullName the resource name
         * @return this, for method chaining.
         */
        public Builder neverLoadedResource(String resourceFullName) {
            Objects.requireNonNull(resourceFullName);
            final boolean add = vetoedResources.add(resourceFullName);
            if (!add) {
                throw new ClassLoaderLimiterConsistencyException(
                        "resource listed multiple times as never loaded: " + resourceFullName);
            }
            if (atMostOnceResources.contains(resourceFullName)) {
                throw new ClassLoaderLimiterConsistencyException(
                        resourceFullName + " is being listed both as never loaded and as at most once");
            }
            return this;
        }

        /**
         * List a fully qualified class name as one that you don't expect to be loaded ever.
         * If there is an attempt of loading the matched class, a runtime exception will be thrown instead:
         * useful for running integration tests to verify your assumptions.
         * <p>
         * DO NOT list the name by doing using <code>literal.class.getName()</code> as this will implicitly get you
         * to load the class during the test, and produce a failure.
         * <p>
         * Limitations: if the class is being loaded using the bootstrap classloader we

View on GitHub (pinned to e1c734241f)

Solutions

  1. Deduplicate: register each never-loaded resource exactly once in the limiter builder.
  2. Centralize common expectations in one shared builder/constant instead of adding them per test.
  3. Check the resource name for accidental duplication with slightly different constants resolving to the same value.

Example fix

// before
builder.neverLoadedResource("x.properties");
builder.neverLoadedResource("x.properties"); // duplicate
// after
builder.neverLoadedResource("x.properties"); // once, in shared setup
Defensive patterns

Strategy: validation

Validate before calling

Set<String> registered = new HashSet<>();
void registerNeverLoaded(Builder b, String name) {
    if (!registered.add(name)) return; // skip duplicates
    b.neverLoadedResource(name);
}

Try / catch

try { builder.neverLoadedResource(name); } catch (ClassLoaderLimiterConsistencyException e) { log.warn("Duplicate never-loaded registration: {}", name); }

Prevention

When it happens

Trigger: Calling builder.neverLoadedResource(name) twice with the same resourceFullName while constructing a ClassLoaderLimiter (often because two callers/modules each add the same expectation).

Common situations: Shared test base classes and individual tests both registering the same never-loaded expectation, or copy-pasted limiter setups in Quarkus core tests.

Related errors


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