{"record":{"id":"c663b1b054bc47cb","repo":"quarkusio/quarkus","slug":"global-variable-field-declared-on-field-declar","errorCode":null,"errorMessage":"Global variable field declared on \" + field.declaringClass().name() + \"  must be static: \" + field","messagePattern":"Global variable field declared on \" \\+ field\\.declaringClass\\(\\)\\.name\\(\\) \\+ \"  must be static: \" \\+ field","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java","lineNumber":183,"sourceCode":"                            + method);\n        }\n        if (method.returnType().kind() == Kind.VOID) {\n            throw new IllegalStateException(\"Global variable method declared on \" + method.declaringClass().name()\n                    + \" must not return void: \" + method);\n        }\n        if (!method.parameterTypes().isEmpty()) {\n            throw new IllegalStateException(\"Global variable method declared on \" + method.declaringClass().name()\n                    + \" must not accept any parameter: \" + method);\n        }\n        if (Modifier.isPrivate(method.flags())) {\n            throw new IllegalStateException(\"Global variable method declared on \" + method.declaringClass().name()\n                    + \" must not be private: \" + method);\n        }\n    }\n\n    public static void validate(FieldInfo field) {\n        if (!Modifier.isStatic(field.flags())) {\n            throw new IllegalStateException(\n                    \"Global variable field declared on \" + field.declaringClass().name() + \"  must be static: \" + field);\n        }\n        if (Modifier.isPrivate(field.flags())) {\n            throw new IllegalStateException(\"Global variable field declared on \" + field.declaringClass().name()\n                    + \" must not be private: \" + field);\n        }\n    }\n}\n","sourceCodeStart":165,"sourceCodeEnd":192,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java#L165-L192","documentation":"IllegalStateException from TemplateGlobalGenerator.validate(FieldInfo): a field annotated @TemplateGlobal is not static. Global variables exposed as fields must be static so their value can be read without an instance; the declaring class and field are included in the message.","triggerScenarios":"Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java:183 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the @TemplateGlobal field static","Or expose the value through a static @TemplateGlobal method instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}