{"record":{"id":"ee9e79f7a369696b","repo":"quarkusio/quarkus","slug":"is-being-listed-both-as-never-loaded-and-as-at-mo","errorCode":null,"errorMessage":" is being listed both as never loaded and as at most once","messagePattern":" is being listed both as never loaded and as at most once","errorType":"exception","errorClass":"ClassLoaderLimiterConsistencyException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java","lineNumber":115,"sourceCode":"         * 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\n         * can't check it. Most Quarkus extensions and frameworks will not use the bootstrap classloader,\n         * but some code could make use of it explicitly.\n         *\n         * @param vetoedClassName the fully qualified class name","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java#L97-L133","documentation":"Thrown by ClassLoaderLimiter.Builder.neverLoadedResource when the same resource name is registered twice as never-loaded, or when it was already registered as loaded-at-most-once. The limiter validates its internal bookkeeping sets are consistent so runtime veto checks are unambiguous. It is a developer/API misuse error, not a runtime classloading failure.","triggerScenarios":"Calling builder.neverLoadedResource(name) twice for the same resourceFullName, or calling it after loadedAtMostOnceResource(name) for the same name.","commonSituations":"Programmatic Quarkus bootstrap code (or generated Runner code) that lists vetoed resources in multiple places, e.g. a framework integration and app code both registering the same resource; copy-pasted builder chains.","solutions":["Remove the duplicate neverLoadedResource call for that resource name","Choose one classification: either neverLoadedResource or loadedAtMostOnceResource, not both","Use a Set in the calling code to deduplicate resource names before feeding the builder"],"exampleFix":"// before\nbuilder.neverLoadedResource(\"META-INF/foo.xml\");\nbuilder.loadedAtMostOnceResource(\"META-INF/foo.xml\"); // throws\n// after\nbuilder.neverLoadedResource(\"META-INF/foo.xml\");","handlingStrategy":"validation","validationCode":"if (!neverLoaded.add(name)) throw new IllegalStateException(\"duplicate never-loaded resource: \" + name);\nif (atMostOnce.contains(name)) throw new IllegalStateException(name + \" already marked at-most-once\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Collect vetoed resources into a Set before configuring the builder","Never register the same resource as both never-loaded and at-most-once","Keep limiter registration code in one module to avoid conflicting registrations"],"tags":["classloading","bootstrap","builder-validation"],"backgroundTag":"duplicate-registration","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}