{"record":{"id":"ee1a81def793f4f9","repo":"quarkusio/quarkus","slug":"template-not-found","errorCode":null,"errorMessage":"Template not found: ","messagePattern":"Template not found: ","errorType":"exception","errorClass":"TemplateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/core/src/main/java/io/quarkus/qute/FragmentNamespaceResolver.java","lineNumber":62,"sourceCode":"    public void engineBuilt(Engine engine) {\n        this.engine = engine;\n    }\n\n    @Override\n    public CompletionStage<Object> resolve(EvalContext context) {\n        String id = context.getName();\n        Template template = null;\n        int idx = id.lastIndexOf('$');\n        if (idx != -1) {\n            // the part before the last occurrence of a dollar sign is the template identifier\n            String templateId = id.substring(0, idx);\n            Engine e = engine;\n            if (e == null) {\n                throw new TemplateException(\"Engine not set\");\n            }\n            template = e.getTemplate(templateId);\n            if (template == null) {\n                throw new TemplateException(\"Template not found: \" + templateId);\n            }\n            // the part after the last occurrence of a dollar sign is the fragment identifier\n            id = id.substring(idx + 1);\n        } else {\n            template = context.resolutionContext().getTemplate();\n        }\n        Fragment fragment = template.getFragment(id);\n        if (fragment != null) {\n            CompletableFuture<Object> ret = new CompletableFuture<>();\n            if (!context.getParams().isEmpty()) {\n                EvaluatedParams params = EvaluatedParams.evaluate(context);\n                params.stage.whenComplete((r, t) -> {\n                    if (t != null) {\n                        ret.completeExceptionally(t);\n                    } else {\n                        Map<String, Object> args = new HashMap<>();\n                        for (int i = 0; i < context.getParams().size(); i++) {\n                            try {","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/core/src/main/java/io/quarkus/qute/FragmentNamespaceResolver.java#L44-L80","documentation":"FragmentNamespaceResolver.resolve() splits the id into templateId$fragmentId and calls engine.getTemplate(templateId). It throws TemplateException(\"Template not found: <id>\") when no template with that identifier is loaded by the engine.","triggerScenarios":"Referencing a fragment like {#frag} from an id such as 'myTemplate$myFragment' where 'myTemplate' was never loaded, is misspelled, or was not included in the build (not in templates dir / not registered).","commonSituations":"Typo in the template id; template not placed under src/main/resources/templates; fragment id uses the wrong path prefix; in tests the template was never injected or loaded; native build excluded the template resource.","solutions":["Verify the template id matches the path under src/main/resources/templates exactly (case-sensitive).","Inject the template via @Location or load it once so the engine has it registered.","Check that the file is included in the native image resources if running native.","Print/inspect available template ids to confirm the expected id exists."],"exampleFix":"// before\n@Inject\nTemplate missing; // never matched -> Template not found: detail$item\n// {frag detail$item}\n// after\n@Inject\n@Location(\"detail\")\nTemplate detail; // matches id 'detail' used in fragment reference detail$item","handlingStrategy":"validation","validationCode":"Template t = engine.getTemplate(\"detail\");\nif (t == null) {\n    throw new IllegalStateException(\"Template 'detail' not on classpath under templates/\");\n}","typeGuard":"boolean templateExists(Engine e, String id) {\n    return e.getTemplate(id) != null;\n}","tryCatchPattern":"try {\n    return resolver.resolve(ctx);\n} catch (TemplateException ex) {\n    if (ex.getMessage().startsWith(\"Template not found\")) {\n        LOGGER.error(\"Check templates dir and fragment id: {}\", ex.getMessage());\n    }\n    throw ex;\n}","preventionTips":["Match template ids exactly to paths under src/main/resources/templates","Inject templates with @Location to fail fast at startup","Verify native-image resource inclusion for template files","Add tests that render every referenced fragment"],"tags":["qute","template","fragments","template-not-found"],"backgroundTag":"resource-not-found","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"}