{"record":{"id":"cf39496e94ab0f3d","repo":"quarkusio/quarkus","slug":"unable-to-create-global-provider","errorCode":null,"errorMessage":"Unable to create global provider: ","messagePattern":"Unable to create global provider: ","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java","lineNumber":383,"sourceCode":"            }\n            throw new IllegalStateException(\"Not a resolver: \" + resolverClassName);\n        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException\n                | InvocationTargetException | NoSuchMethodException | SecurityException e) {\n            throw new IllegalStateException(\"Unable to create resolver: \" + resolverClassName, e);\n        }\n    }\n\n    private TemplateGlobalProvider createGlobalProvider(String initializerClassName) {\n        try {\n            Class<?> initializerClazz = Thread.currentThread()\n                    .getContextClassLoader().loadClass(initializerClassName);\n            if (TemplateGlobalProvider.class.isAssignableFrom(initializerClazz)) {\n                return (TemplateGlobalProvider) initializerClazz.getDeclaredConstructor().newInstance();\n            }\n            throw new IllegalStateException(\"Not a global provider: \" + initializerClazz);\n        } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException\n                | InvocationTargetException | NoSuchMethodException | SecurityException e) {\n            throw new IllegalStateException(\"Unable to create global provider: \" + initializerClassName, e);\n        }\n    }\n\n    private boolean isExcluded(String path) {\n        for (Pattern p : templatePathExcludes) {\n            if (p.matcher(path).matches()) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private Optional<TemplateLocation> locate(String path) {\n        if (isExcluded(path)) {\n            return Optional.empty();\n        }\n        // First try the template contents, i.e. templates not backed by files\n        LOGGER.debugf(\"Locate template contents for %s\", path);","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/EngineProducer.java#L365-L401","documentation":"EngineProducer.createGlobalProvider wraps all reflective failures when instantiating a configured TemplateGlobalProvider into this IllegalStateException, with the underlying exception as cause. The message appends initializerClassName from the quarkus.qute.global-provider.<n>.classes config.","triggerScenarios":"The configured global provider class is not on the classpath, is abstract/an interface, has no public no-arg constructor, or its constructor throws — at Quarkus engine creation time.","commonSituations":"Class name typo; provider class lives in a dependency not shipped; no-arg constructor missing after refactoring; native image lacking reflection metadata for the class.","solutions":["Inspect the cause chain to identify missing class vs missing constructor vs constructor exception.","Correct the class name or add the missing dependency/module.","Give the provider a public no-arg constructor.","For native image, ensure the class is registered for reflection (Quarkus usually handles config-referenced classes — verify your build)."],"exampleFix":"// before\nclass MyGlobals { public MyGlobals(String cfg) {...} } // no no-arg ctor\n// after\nclass MyGlobals { public MyGlobals() {...} }","handlingStrategy":"validation","validationCode":"try { Class.forName(\"com.example.MyGlobals\").getConstructor(); } catch (ClassNotFoundException | NoSuchMethodException e) { throw new IllegalStateException(\"Provider missing or lacks no-arg constructor\", e); }","typeGuard":null,"tryCatchPattern":"try { app.start(); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Unable to create global provider\")) { log.error(\"Cause: \", e.getCause()); } else throw e; }","preventionTips":["Always give global providers a public no-arg constructor","Confirm the dependency containing the class is on the runtime classpath","Test startup in JVM and native profiles"],"tags":["qute","reflection","configuration","classpath"],"backgroundTag":"reflective-instantiation-failed","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"}