{"record":{"id":"2758f522521be94c","repo":"quarkusio/quarkus","slug":"global-variable-method-declared-on-method-decl-2758f5","errorCode":null,"errorMessage":"Global variable method declared on \" + method.declaringClass().name() + \" must not return void: \" + method","messagePattern":"Global variable method declared on \" \\+ method\\.declaringClass\\(\\)\\.name\\(\\) \\+ \" must not return void: \" \\+ method","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java","lineNumber":168,"sourceCode":"                    bc.return_(bc.invokeStatic(Descriptors.RESULTS_NOT_FOUND_EC, evalContext));\n                });\n            });\n        });\n        return generatedClassName;\n    }\n\n    public Set<String> getGeneratedTypes() {\n        return generatedTypes;\n    }\n\n    public static void validate(MethodInfo method) {\n        if (!Modifier.isStatic(method.flags())) {\n            throw new IllegalStateException(\n                    \"Global variable method declared on \" + method.declaringClass().name() + \" must be static: \"\n                            + 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())) {","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java#L150-L186","documentation":"IllegalStateException from TemplateGlobalGenerator.validate(MethodInfo): the @TemplateGlobal method is declared void. A global variable must yield a value, so the generator rejects void return types; the declaring class and method are included in the message.","triggerScenarios":"Thrown at independent-projects/qute/generator/src/main/java/io/quarkus/qute/generator/TemplateGlobalGenerator.java:168 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Change the method's return type to the type of the global value","Or remove @TemplateGlobal from the void method"],"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"}