quarkusio/quarkus · error · IllegalStateException
Global variable field declared on " + field.declaringClass()
Error message
Global variable field declared on " + field.declaringClass().name() + " must not be private: " + field
What it means
IllegalStateException from TemplateGlobalGenerator.validate(FieldInfo): a field annotated @TemplateGlobal is private, so generated template code cannot read it. The build fails naming the declaring class and field.
Source
Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java:187
+ " must not return void: " + method);
}
if (!method.parameterTypes().isEmpty()) {
throw new IllegalStateException("Global variable method declared on " + method.declaringClass().name()
+ " must not accept any parameter: " + method);
}
if (Modifier.isPrivate(method.flags())) {
throw new IllegalStateException("Global variable method declared on " + method.declaringClass().name()
+ " must not be private: " + method);
}
}
public static void validate(FieldInfo field) {
if (!Modifier.isStatic(field.flags())) {
throw new IllegalStateException(
"Global variable field declared on " + field.declaringClass().name() + " must be static: " + field);
}
if (Modifier.isPrivate(field.flags())) {
throw new IllegalStateException("Global variable field declared on " + field.declaringClass().name()
+ " must not be private: " + field);
}
}
}
View on GitHub (pinned to e1c734241f)
Solutions
- Make the @TemplateGlobal field non-private (public/package)
- Expose the value via a static getter method instead
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java:187 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/8312039ca5e15fb6.
Report an issue: GitHub.