{"record":{"id":"00cba90f70d44e33","repo":"quarkusio/quarkus","slug":"no-template-location-specified","errorCode":null,"errorMessage":"No template location specified","messagePattern":"No template location specified","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/TemplateProducer.java","lineNumber":107,"sourceCode":"                name = injectionPoint.getMember().getName();\n                LOGGER.warnf(\"Parameter name not present - using the method name as the template name instead %s\", name);\n            }\n        }\n        return newInjectableTemplate(name);\n    }\n\n    @Produces\n    @Location(\"ignored\")\n    Template getTemplate(InjectionPoint injectionPoint) {\n        String path = null;\n        for (Annotation qualifier : injectionPoint.getQualifiers()) {\n            if (qualifier.annotationType().equals(Location.class)) {\n                path = ((Location) qualifier).value();\n                break;\n            }\n        }\n        if (path == null || path.isEmpty()) {\n            throw new IllegalStateException(\"No template location specified\");\n        }\n        return newInjectableTemplate(path);\n    }\n\n    /**\n     * Used by NativeCheckedTemplateEnhancer to inject calls to this method in the native type-safe methods.\n     */\n    public Template getInjectableTemplate(String path) {\n        return newInjectableTemplate(path);\n    }\n\n    public void clearInjectedTemplates() {\n        if (injectedTemplates != null) {\n            synchronized (injectedTemplates) {\n                for (Iterator<WeakReference<InjectableTemplate>> it = injectedTemplates.iterator(); it.hasNext();) {\n                    WeakReference<InjectableTemplate> ref = it.next();\n                    InjectableTemplate template = ref.get();\n                    if (template == null) {","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/qute/runtime/src/main/java/io/quarkus/qute/runtime/TemplateProducer.java#L89-L125","documentation":"TemplateProducer.getTemplate(InjectionPoint) resolves the template path for an injected @Location-qualified template or a type-safe @CheckedTemplate. When a @Location annotation is required (non-type-safe injection) but no path can be determined, injection fails with this IllegalStateException at startup.","triggerScenarios":"Injecting a Template field/parameter with no @Location qualifier and no accompanying @CheckedTemplate-generated path, e.g. `@Inject Template tpl;` without any way to derive the location.","commonSituations":"Adding a Template injection point without @Location and outside a @CheckedTemplate class; removing a @Location annotation during refactoring; incorrect annotation import so the Location qualifier is not recognized.","solutions":["Annotate the injection point with @Location(\"path/to/template\") matching a template under src/main/resources/templates.","Use @CheckedTemplate static fields instead of raw Template injection to get generated locations.","Verify you import io.quarkus.qute.Location (not a same-named annotation from another library).","Inject a concrete generated template class instead of the generic Template type."],"exampleFix":"// before\n@Inject\nTemplate page;\n// after\n@Inject\n@Location(\"pages/page\")\nTemplate page;","handlingStrategy":"validation","validationCode":"if (tpl.getClass().isAnnotationPresent(Location.class) == false && !inCheckedTemplate) {\n    throw new IllegalArgumentException(\"Template injection needs @Location\");\n}","typeGuard":"boolean hasLocation(jakarta.enterprise.inject.spi.InjectionPoint ip) {\n    return ip.getAnnotated().isAnnotationPresent(io.quarkus.qute.Location.class);\n}","tryCatchPattern":"try { ctx.deploy(); } catch (IllegalStateException e) { if (e.getMessage().equals(\"No template location specified\")) { /* add @Location or use @CheckedTemplate */ } else throw e; }","preventionTips":["Always use @Location with raw Template injection","Prefer @CheckedTemplate type-safe templates","Watch for same-named Location annotations from other libraries"],"tags":["qute","cdi","injection","location"],"backgroundTag":"missing-template-location","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"}