{"record":{"id":"a5c7cc6ef6bfbb60","repo":"quarkusio/quarkus","slug":"attempted-to-load-vetoed-resource","errorCode":null,"errorMessage":"Attempted to load vetoed resource '","messagePattern":"Attempted to load vetoed resource '","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java","lineNumber":44,"sourceCode":"        vetoedRuntimeClasses = builder.vetoedRuntimeClasses;\n        atMostOnceResources = builder.atMostOnceResources;\n        onHitPrintStacktrace = builder.onHitPrintStacktrace;\n        traceAllResourceLoad = builder.traceAllResourceLoad;\n    }\n\n    @Override\n    public void openResourceStream(String resourceName, String classLoaderName) {\n        Objects.requireNonNull(resourceName);\n        Objects.requireNonNull(classLoaderName);\n        if (traceAllResourceLoad) {\n            System.out.println(\"Opening resource: \" + resourceName);\n        }\n        if (onHitPrintStacktrace.contains(resourceName)) {\n            final RuntimeException e = new RuntimeException(\"Tracing load of resource: \" + resourceName);\n            e.printStackTrace();\n        }\n        if (vetoedResources.contains(resourceName)) {\n            throw new IllegalStateException(\n                    \"Attempted to load vetoed resource '\" + resourceName + \"' from classloader \" + classLoaderName);\n        }\n        if (atMostOnceResources.contains(resourceName)) {\n            final String previousLoadEvent = atMostOnceResourcesLoaded.put(resourceName, classLoaderName);\n            if (previousLoadEvent != null) {\n                throw new IllegalStateException(\"Resource being loaded more than once: \" + resourceName + \".\\n\" +\n                        \"Attempted load by \" + classLoaderName + \", recorded previous load by \" + previousLoadEvent);\n            }\n        }\n        if (resourceName.endsWith(\".class\")) {\n            //Skip further tracking on classes as it would create unnecessary noise\n            return;\n        }\n        final String previousLoad = allResourcesLoaded.put(resourceName, classLoaderName);\n        if (previousLoad != null) {\n            //This diagnostic has no flag, as it's generally useful, doesn't throw exceptions, and should\n            //generally not log much at all.\n            System.out.println(","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/bootstrap/core/src/main/java/io/quarkus/bootstrap/classloading/ClassLoaderLimiter.java#L26-L62","documentation":"ClassLoaderLimiter is a test/diagnostic hook that can veto specific resources. openResourceStream throws this IllegalStateException when the resource name appears in the configured vetoedResources set, deliberately failing the load so tests can assert a resource is never requested from the given classloader.","triggerScenarios":"A QuarkusClassLoader created with a ClassLoaderLimiter that lists a resource in vetoedResources attempts to open that resource; openResourceStream is called for it.","commonSituations":"Quarkus core/integration tests enforcing that, e.g., dev-mode or runtime resources are never touched in certain modes; regressions where new code starts reading a resource that must not be loaded.","solutions":["Fix application/library code to stop requesting the vetoed resource in that classloader.","If the load is now legitimate, remove the resource from the limiter's neverLoadedResource builder configuration.","Use the stack trace accompanying the failure to find which code path performs the unwanted load."],"exampleFix":"// before\nClassLoaderLimiter.builder().neverLoadedResource(\"quarkus-dev-mode.properties\")...\n// after (if the load is legitimate now)\nClassLoaderLimiter.builder()... // remove neverLoadedResource(\"quarkus-dev-mode.properties\")","handlingStrategy":"validation","validationCode":"// before opening the resource, check limiter config\nif (limiterVetoedResources.contains(resourceName)) {\n    throw new AssertionError(\"Code path must not read \" + resourceName);\n}","typeGuard":null,"tryCatchPattern":"try { cl.getResourceAsStream(name); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Attempted to load vetoed resource\")) { failWithStacktrace(e); } else { throw e; } }","preventionTips":["Keep limiter veto lists synchronized with actual resource-reading code paths.","Run limiter-enabled tests in CI to catch new unwanted loads early.","Remove veto registrations when a load becomes legitimate."],"tags":["classloading","test-tooling","classloader-limiter"],"backgroundTag":"vetoed-resource-load","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"}