quarkusio/quarkus · error · CodestartException

Error while rendering template: + source.absolutePath()

Error message

Error while rendering template: + source.absolutePath()

What it means

readQuteFile parses a codestart Qute template and renders it with the provided data map. Any exception during parse or render (unresolved expression, bad include, syntax error) is wrapped in this CodestartException naming the source template. The root cause is attached as the cause.

Source

Thrown at independent-projects/tools/codestarts/src/main/java/io/quarkus/devtools/codestarts/core/reader/QuteCodestartFileReader.java:90

                .addResultMapper(new MissingValueMapper())
                .removeStandaloneLines(true)
                // For now we need to disable strict rendering for codestarts
                // A param of an {#if} section is not considered falsy if the value represents a "not found" result
                // https://github.com/quarkusio/quarkus/pull/18227#discussion_r662301281
                .strictRendering(false)
                .addLocator(
                        id -> findIncludeTemplate(source.getCodestartResource(), languageName, id)
                                .map(IncludeTemplateLocation::new))
                .addLocator(
                        id -> findIncludeTemplate(projectResource, languageName, id)
                                .map(IncludeTemplateLocation::new))
                .addLocator(id -> Optional.of(new FallbackTemplateLocation()))
                .addSectionHelper(new EvalSectionHelper.Factory())
                .build();
        try {
            return engine.parse(content, null, templateId).render(data);
        } catch (Exception e) {
            throw new CodestartException("Error while rendering template: " + source.absolutePath(), e);
        }
    }

    private static Optional<Source> findIncludeTemplate(CodestartResource projectResource, String languageName, String name) {
        final String includeFileName = name + INCLUDE_QUTE_FLAG;
        final Optional<Source> languageIncludeSource = projectResource.getSource(languageName, includeFileName);
        if (languageIncludeSource.isPresent()) {
            return languageIncludeSource;
        }
        final Optional<Source> baseIncludeSource = projectResource.getSource("base", includeFileName);
        if (baseIncludeSource.isPresent()) {
            return baseIncludeSource;
        }
        return Optional.empty();
    }

    private static class FallbackTemplateLocation implements TemplateLocator.TemplateLocation {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Inspect the wrapped cause exception to find the failing expression/line in the named template
  2. Fix the Qute syntax or define/default the missing data key in the codestart's data map
  3. Verify any {#include ...} targets exist as `<name>.qute.*` files for the language

Example fix

# before (template)
Value: {config.missingKey}
# after
Value: {config.missingKey ?: 'default'}
Defensive patterns

Strategy: try-catch

Try / catch

try { renderTemplate(...); }
catch (CodestartException e) {
    log.error("Render failed for " + e.getMessage() + ", cause:", e.getCause());
}

Prevention

When it happens

Trigger: Generating a project from a codestart whose template file contains invalid Qute syntax, references an undefined {expression} with no default, or includes a nonexistent {#include} template.

Common situations: Editing codestart templates and introducing a typo in an expression; template conditions referencing missing config keys; include name mismatches (missing `.qute.` include file for the language).

Related errors


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