quarkusio/quarkus · error · TemplateException
${exception}
Error message
${exception} What it means
CompletedStage.get() (Qute) rethrows the exception the stage was completed with. If it is already a TemplateException it is thrown as-is; any other exception is wrapped in a TemplateException. Message is the original exception's message, so `${exception}` reflects the underlying error.
Source
Thrown at independent-projects/qute/core/src/main/java/io/quarkus/qute/CompletedStage.java:68
private final T result;
private final Throwable exception;
private CompletedStage(T result, Throwable exception) {
this.result = result;
this.exception = exception;
}
public boolean isFailure() {
return exception != null;
}
public T get() {
if (exception != null) {
if (exception instanceof TemplateException te) {
throw te;
}
// Always wrap the original exception if completed exceptionally
throw new TemplateException(exception);
}
return result;
}
@Override
public <U> CompletionStage<U> thenApply(Function<? super T, ? extends U> fn) {
Objects.requireNonNull(fn);
if (exception == null) {
final U u;
try {
u = fn.apply(this.result);
} catch (Throwable e) {
return new CompletedStage<>(null, e);
}
return new CompletedStage<>(u, null);
}
return new CompletedStage<>(null, exception);
}View on GitHub (pinned to e1c734241f)
Solutions
- Read the wrapped cause chain — fix the original template/expression error it reports
- Fix the template expression referenced by the cause (missing property, wrong method name)
- Register a value resolver or add the missing property/method to the data model
- In custom code, prefer toCompleteStage()/join with proper error handling rather than raw get()
Example fix
// before
Object v = completedStage.get(); // throws TemplateException wrapping cause
// after
try {
Object v = completedStage.get();
} catch (TemplateException e) {
logger.error("Qute evaluation failed", e.getCause());
} Defensive patterns
Strategy: try-catch
Validate before calling
if (stage.isCompletedExceptionally()) {
// inspect cause before get()
stage.exceptionally(t -> { log.error("Qute eval failed", t); return null; });
} Try / catch
try {
T value = completedStage.get();
} catch (TemplateException e) {
Throwable cause = e.getCause(); // fix the original template error
} Prevention
- Fix the root cause in the template/expr from the wrapped exception
- Test templates with sample data models
- Prefer non-blocking result handling in reactive code
- Keep data-model properties/methods aligned with template usage
When it happens
Trigger: Calling get() on a CompletedStage completed exceptionally, typically when a Qute expression evaluation fails (missing property, resolver error) and the engine materializes the result synchronously.
Common situations: Template rendering errors surfacing during evaluation: nonexistent bean properties, failed method invocations, or errors thrown inside value resolvers; also seen when blocking on results in tests or custom extensions.
Related errors
- No suitable template variant found
- Class [<rawClassName>] used in the parameter declaration in
- #cache cannot be used without the 'quarkus-cache' extension
- Template source not available
- Not a formattable date/time object:
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/3940859e6bae9249.
Report an issue: GitHub.