{"record":{"id":"ba34a9400dfe9e9c","repo":"quarkusio/quarkus","slug":"template-templateid-is-not-parsed-yet","errorCode":null,"errorMessage":"Template [\" + templateId + \"] is not parsed yet","messagePattern":"Template \\[\" \\+ templateId \\+ \"\\] is not parsed yet","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java","lineNumber":129,"sourceCode":"    }\n\n    static class RootSectionHelperFactory implements SectionHelperFactory<SectionHelper> {\n\n        @Override\n        public SectionHelper initialize(SectionInitContext context) {\n            return new SectionHelper() {\n\n                @Override\n                public CompletionStage<ResultNode> resolve(SectionResolutionContext context) {\n                    return context.execute();\n                }\n            };\n        }\n    }\n\n    private Template currentTemplate() {\n        if (template == null) {\n            throw new IllegalStateException(\"Template [\" + templateId + \"] is not parsed yet\");\n        }\n        return template;\n    }\n\n    Template parse() {\n\n        SectionNode.Builder rootBuilder = SectionNode.builder(ROOT_HELPER_NAME, syntheticOrigin(), this, this)\n                .setEngine(engine)\n                .setHelperFactory(ROOT_SECTION_HELPER_FACTORY);\n        sectionStack.addFirst(rootBuilder);\n\n        // Add synthetic nodes for param declarations added by parser hooks\n        Map<String, String> bindings = scopeStack.peek().getBindings();\n        if (bindings != null && !bindings.isEmpty()) {\n            for (Entry<String, String> e : bindings.entrySet()) {\n                rootBuilder.currentBlock().addNode(\n                        new ParameterDeclarationNode(e.getValue(), e.getKey(), null, syntheticOrigin()));\n            }","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java#L111-L147","documentation":"Parser.currentTemplate() lazily exposes the Template being built; it is only available once parsing has actually started. If it is accessed while template is still null (before Parser.parse() begins or during construction), IllegalStateException 'Template [id] is not parsed yet' is thrown. It is an internal ordering guard for parser callbacks and helper access to the in-progress template.","triggerScenarios":"Accessing the parser's current template before parse() is invoked — e.g. custom code instantiating Parser and querying the template first, or a build-time extension/annotation processor touching the parser's template too early.","commonSituations":"Custom tooling around Qute's parser API (CDI/ArC or Dev UI template processing), or a framework bug where a parser hook fires before parsing starts; end users rarely see it directly.","solutions":["Call parse() before accessing the template, or restructure code so the template is only consumed from within parse()-driven callbacks","If you hold a Parser reference, keep a flag/handle to the returned Template from parse() instead of reading the internal field","Verify Quarkus version and file a bug with the template id if a stock template triggers this"],"exampleFix":"// before\nParser p = new Parser(templateId, ...);\nTemplate t = p.currentTemplate(); // throws: not parsed yet\n// after\nParser p = new Parser(templateId, ...);\nTemplate t = p.parse();","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Template t = parser.parse();\n} catch (IllegalStateException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"is not parsed yet\")) {\n        throw new IllegalStateException(\"Accessed parser template before parse(); call parse() first\", e);\n    }\n    throw e;\n}","preventionTips":["Never read the parser's internal template before calling parse()","Consume the template only from parse()-driven callbacks","Keep references to the Template returned by parse() instead of the parser's field"],"tags":["qute","parser","lifecycle","template"],"backgroundTag":"uninitialized-template","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"}