quarkusio/quarkus · error · IllegalStateException
Template [" + templateId + "] is not parsed yet
Error message
Template [" + templateId + "] is not parsed yet
What it means
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.
Source
Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/Parser.java:129
}
static class RootSectionHelperFactory implements SectionHelperFactory<SectionHelper> {
@Override
public SectionHelper initialize(SectionInitContext context) {
return new SectionHelper() {
@Override
public CompletionStage<ResultNode> resolve(SectionResolutionContext context) {
return context.execute();
}
};
}
}
private Template currentTemplate() {
if (template == null) {
throw new IllegalStateException("Template [" + templateId + "] is not parsed yet");
}
return template;
}
Template parse() {
SectionNode.Builder rootBuilder = SectionNode.builder(ROOT_HELPER_NAME, syntheticOrigin(), this, this)
.setEngine(engine)
.setHelperFactory(ROOT_SECTION_HELPER_FACTORY);
sectionStack.addFirst(rootBuilder);
// Add synthetic nodes for param declarations added by parser hooks
Map<String, String> bindings = scopeStack.peek().getBindings();
if (bindings != null && !bindings.isEmpty()) {
for (Entry<String, String> e : bindings.entrySet()) {
rootBuilder.currentBlock().addNode(
new ParameterDeclarationNode(e.getValue(), e.getKey(), null, syntheticOrigin()));
}View on GitHub (pinned to e1c734241f)
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
Example fix
// before Parser p = new Parser(templateId, ...); Template t = p.currentTemplate(); // throws: not parsed yet // after Parser p = new Parser(templateId, ...); Template t = p.parse();
Defensive patterns
Strategy: try-catch
Try / catch
try {
Template t = parser.parse();
} catch (IllegalStateException e) {
if (e.getMessage() != null && e.getMessage().contains("is not parsed yet")) {
throw new IllegalStateException("Accessed parser template before parse(); call parse() first", e);
}
throw e;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid composite parameter found:
- Invalid template link [${templateLink}] - Expeting a link th
- Templates that are not backed by a file must provide extensi
- Literal must not be null
- Expression is not a literal:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/ba34a9400dfe9e9c.
Report an issue: GitHub.