{"record":{"id":"3940859e6bae9249","repo":"quarkusio/quarkus","slug":"exception","errorCode":null,"errorMessage":"${exception}","messagePattern":"\\$\\{exception\\}","errorType":"exception","errorClass":"TemplateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/core/src/main/java/io/quarkus/qute/CompletedStage.java","lineNumber":68,"sourceCode":"    private final T result;\n    private final Throwable exception;\n\n    private CompletedStage(T result, Throwable exception) {\n        this.result = result;\n        this.exception = exception;\n    }\n\n    public boolean isFailure() {\n        return exception != null;\n    }\n\n    public T get() {\n        if (exception != null) {\n            if (exception instanceof TemplateException te) {\n                throw te;\n            }\n            // Always wrap the original exception if completed exceptionally\n            throw new TemplateException(exception);\n        }\n        return result;\n    }\n\n    @Override\n    public <U> CompletionStage<U> thenApply(Function<? super T, ? extends U> fn) {\n        Objects.requireNonNull(fn);\n        if (exception == null) {\n            final U u;\n            try {\n                u = fn.apply(this.result);\n            } catch (Throwable e) {\n                return new CompletedStage<>(null, e);\n            }\n            return new CompletedStage<>(u, null);\n        }\n        return new CompletedStage<>(null, exception);\n    }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/core/src/main/java/io/quarkus/qute/CompletedStage.java#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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()"],"exampleFix":"// before\nObject v = completedStage.get(); // throws TemplateException wrapping cause\n// after\ntry {\n    Object v = completedStage.get();\n} catch (TemplateException e) {\n    logger.error(\"Qute evaluation failed\", e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"if (stage.isCompletedExceptionally()) {\n    // inspect cause before get()\n    stage.exceptionally(t -> { log.error(\"Qute eval failed\", t); return null; });\n}","typeGuard":null,"tryCatchPattern":"try {\n    T value = completedStage.get();\n} catch (TemplateException e) {\n    Throwable cause = e.getCause(); // fix the original template error\n}","preventionTips":["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"],"tags":["qute","templates","exception-wrapping"],"backgroundTag":"template-rendering-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}