{"record":{"id":"42e4c1a8495a3132","repo":"quarkusio/quarkus","slug":"resource-listed-multiple-times-as-never-loaded","errorCode":null,"errorMessage":"resource listed multiple times as never loaded: ","messagePattern":"resource listed multiple times as never loaded: ","errorType":"exception","errorClass":"ClassLoaderLimiterConsistencyException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java","lineNumber":111,"sourceCode":"        }\n\n        /**\n         * List a resource name as one that you don't expect to be loaded ever.\n         * If there is an attempt of loading the matched resource, a runtime exception will be thrown instead:\n         * useful for running integration tests to verify your assumptions.\n         * <p>\n         * Limitations: if the resource is being loaded using the bootstrap classloader we\n         * can't check it; some frameworks explicitly request using the base classloader\n         * for resource loading (or even use the Filesystem API), so they can't be tested via this method.\n         *\n         * @param resourceFullName the resource name\n         * @return this, for method chaining.\n         */\n        public Builder neverLoadedResource(String resourceFullName) {\n            Objects.requireNonNull(resourceFullName);\n            final boolean add = vetoedResources.add(resourceFullName);\n            if (!add) {\n                throw new ClassLoaderLimiterConsistencyException(\n                        \"resource listed multiple times as never loaded: \" + resourceFullName);\n            }\n            if (atMostOnceResources.contains(resourceFullName)) {\n                throw new ClassLoaderLimiterConsistencyException(\n                        resourceFullName + \" is being listed both as never loaded and as at most once\");\n            }\n            return this;\n        }\n\n        /**\n         * List a fully qualified class name as one that you don't expect to be loaded ever.\n         * If there is an attempt of loading the matched class, a runtime exception will be thrown instead:\n         * useful for running integration tests to verify your assumptions.\n         * <p>\n         * DO NOT list the name by doing using <code>literal.class.getName()</code> as this will implicitly get you\n         * to load the class during the test, and produce a failure.\n         * <p>\n         * Limitations: if the class is being loaded using the bootstrap classloader we","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java#L93-L129","documentation":"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.","triggerScenarios":"Calling builder.neverLoadedResource(name) twice with the same resourceFullName while constructing a ClassLoaderLimiter (often because two callers/modules each add the same expectation).","commonSituations":"Shared test base classes and individual tests both registering the same never-loaded expectation, or copy-pasted limiter setups in Quarkus core tests.","solutions":["Deduplicate: register each never-loaded resource exactly once in the limiter builder.","Centralize common expectations in one shared builder/constant instead of adding them per test.","Check the resource name for accidental duplication with slightly different constants resolving to the same value."],"exampleFix":"// before\nbuilder.neverLoadedResource(\"x.properties\");\nbuilder.neverLoadedResource(\"x.properties\"); // duplicate\n// after\nbuilder.neverLoadedResource(\"x.properties\"); // once, in shared setup","handlingStrategy":"validation","validationCode":"Set<String> registered = new HashSet<>();\nvoid registerNeverLoaded(Builder b, String name) {\n    if (!registered.add(name)) return; // skip duplicates\n    b.neverLoadedResource(name);\n}","typeGuard":null,"tryCatchPattern":"try { builder.neverLoadedResource(name); } catch (ClassLoaderLimiterConsistencyException e) { log.warn(\"Duplicate never-loaded registration: {}\", name); }","preventionTips":["Track already-registered resource names before calling neverLoadedResource.","Put shared expectations in one central test fixture.","Compare resource name constants to avoid accidental case/whitespace duplicates."],"tags":["classloading","test-tooling","classloader-limiter","builder"],"backgroundTag":"duplicate-configuration","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}