quarkusio/quarkus · error · TemplateException

Missing required data: {" + expression.toOriginalString() +

Error message

Missing required data: {" + expression.toOriginalString() + "}

What it means

QuteCodestartFileReader installs a fallback value resolver for expressions not resolved from the provided data. Except for the special 'merged-content' marker, any unresolved expression makes rendering fail with this TemplateException. It guarantees templates only reference data actually supplied at generation time.

Source

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

        }

        @Override
        public Optional<Variant> getVariant() {
            return Optional.empty();
        }
    }

    static class MissingValueMapper implements ResultMapper {

        public boolean appliesTo(TemplateNode.Origin origin, Object result) {
            return Results.isNotFound(result);
        }

        public String map(Object result, Expression expression) {
            if (expression.toOriginalString().equals("merged-content")) {
                return "{merged-content}";
            }
            throw new TemplateException("Missing required data: {" + expression.toOriginalString() + "}");
        }
    }

    /**
     * private static CompletionStage<Object> replaceResolveAsync(EvalContext context) {
     * String text = (String) context.getBase();
     * switch (context.getName()) {
     * case "replace":
     * if (context.getParams().size() == 2) {
     * return context.evaluate(context.getParams().get(0)).thenCombine(context.evaluate(context.getParams().get(1)),
     * (r1, r2) -> CompletableFuture.completedFuture(text.replace(r1.toString(), r2.toString())));
     * }
     * default:
     * return Results.NOT_FOUND;
     * }
     * }
     **/

View on GitHub (pinned to e1c734241f)

Solutions

  1. Add the missing key/value to the data map passed to project generation
  2. Correct the expression in the template to match an existing data key
  3. Provide an inline default in the template: {myKey ?: 'fallback'}

Example fix

// before
Map.of("name", projectName) // template uses {groupId}
// after
Map.of("name", projectName, "groupId", groupId)
Defensive patterns

Strategy: validation

Validate before calling

// verify all {expr} tokens in templates are covered by data keys or '?:' defaults

Try / catch

try { generate.generateProject(dir, data); }
catch (Exception e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Missing required data:")) { /* add key, retry */ }
    else throw e;
}

Prevention

When it happens

Trigger: Rendering a codestart Qute template that references {someExpression} not present in the generation data map and not defaulted with '?:' — the no-data fallback resolver throws for it.

Common situations: Typo in a data key inside the template; codestart data map missing a key the template expects; relying on Qute's null-value default behavior which this reader intentionally disables.

Related errors


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