quarkusio/quarkus · error · IllegalStateException
Unsupported target: " + e.getValue()
Error message
Unsupported target: " + e.getValue()
What it means
@TemplateGlobal can only be applied to supported targets (fields and specific method kinds). When processing the annotated members, the generator switches on the annotation target kind and throws IllegalStateException for any kind it does not handle (e.g. an unexpected member type like CONSTRUCTOR or unsupported element).
Source
Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java:143
mc.body(bc -> {
Expr name = bc.invokeInterface(Descriptors.GET_NAME, evalContext);
bc.switch_(name, sc -> {
for (Entry<String, AnnotationTarget> e : targets.entrySet()) {
sc.caseOf(Const.of(e.getKey()), cbc -> {
switch (e.getValue().kind()) {
case FIELD:
FieldInfo field = e.getValue().asField();
LocalVar val = cbc.localVar("val", cbc.getStaticField(fieldDescOf(field)));
processReturnVal(cbc, field.type(), val, cc);
break;
case METHOD:
MethodInfo method = e.getValue().asMethod();
LocalVar val2 = cbc.localVar("val", cbc.invokeStatic(methodDescOf(method)));
processReturnVal(cbc, method.returnType(), val2, cc);
break;
default:
throw new IllegalStateException("Unsupported target: " + e.getValue());
}
});
}
sc.default_(dbc -> {
});
});
bc.return_(bc.invokeStatic(Descriptors.RESULTS_NOT_FOUND_EC, evalContext));
});
});
});
return generatedClassName;
}
public Set<String> getGeneratedTypes() {
return generatedTypes;
}
public static void validate(MethodInfo method) {View on GitHub (pinned to e1c734241f)
Solutions
- Ensure @TemplateGlobal is only on supported members: fields and no-arg methods with non-void returns
- Remove the annotation from the unsupported member
- Upgrade/patch Quarkus if a legitimate target kind is unsupported (file a Quarkus issue)
Example fix
// before
@TemplateGlobal
public MyGlobal() {}
// after
@TemplateGlobal
public static String globalName() { return "x"; } Defensive patterns
Strategy: validation
Validate before calling
if (m.isAnnotationPresent(TemplateGlobal.class) && (m.getParameterCount() != 0 || m.getReturnType() == void.class))
throw new IllegalStateException("@TemplateGlobal methods must be no-arg with non-void return"); Prevention
- Only annotate fields and simple no-arg getter-like methods with @TemplateGlobal
- Never annotate constructors or initializers
- Consult the @TemplateGlobal javadoc for supported targets before use
When it happens
Trigger: Placing @TemplateGlobal on a member type not supported by the generator, or an internal inconsistency in the Jandex annotation target map; raised in TemplateGlobalGenerator.generate during build.
Common situations: Annotating a constructor or static initializer by mistake; a library version where new target kinds exist but the generator hasn't been updated; custom annotation copying that mislabels targets.
Related errors
- Message bundle name [%s] declared on %s must be a valid name
- Message bundle interface name conflict - [%s] is used for bo
- @MessageBundle must be declared on an interface: {bundleClas
- <startsWith> match the path <templatePath> but the file suff
- Parameter names not recorded for <targetClass>: compile the
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/e3f18c02dd5048c7.
Report an issue: GitHub.