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

  1. Call parse() before accessing the template, or restructure code so the template is only consumed from within parse()-driven callbacks
  2. If you hold a Parser reference, keep a flag/handle to the returned Template from parse() instead of reading the internal field
  3. 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

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


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/ba34a9400dfe9e9c. Report an issue: GitHub.