{"record":{"id":"c2a7a477934b7437","repo":"quarkusio/quarkus","slug":"no-template-resource-path-specified","errorCode":null,"errorMessage":"No template resource path specified","messagePattern":"No template resource path specified","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/MailTemplateProducer.java","lineNumber":71,"sourceCode":"                return new MailTemplateInstanceImpl(getReactiveMailer(injectionPoint, reactiveMailer),\n                        template.select(new LocationLiteral(name)).get().instance());\n            }\n\n        };\n    }\n\n    @Location(\"ignored\")\n    @Produces\n    MailTemplate get(InjectionPoint injectionPoint, @Any Instance<ReactiveMailer> reactiveMailer) {\n        Location path = null;\n        for (Annotation qualifier : injectionPoint.getQualifiers()) {\n            if (qualifier.annotationType().equals(Location.class)) {\n                path = (Location) qualifier;\n                break;\n            }\n        }\n        if (path == null || path.value().isEmpty()) {\n            throw new IllegalStateException(\"No template resource path specified\");\n        }\n        final String name = path.value();\n        return new MailTemplate() {\n            @Override\n            public MailTemplateInstance instance() {\n                return new MailTemplateInstanceImpl(getReactiveMailer(injectionPoint, reactiveMailer),\n                        template.select(new LocationLiteral(name)).get().instance());\n            }\n        };\n    }\n\n    static ReactiveMailer getReactiveMailer(InjectionPoint injectionPoint, Instance<ReactiveMailer> reactiveMailer) {\n        MailTemplateMailerName mailerName = injectionPoint.getAnnotated().getAnnotation(MailTemplateMailerName.class);\n        if (mailerName != null) {\n            return reactiveMailer.select(MailerName.Literal.of(mailerName.value())).get();\n        }\n        return reactiveMailer.select(Default.Literal.INSTANCE).get();\n    }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/mailer/runtime/src/main/java/io/quarkus/mailer/runtime/MailTemplateProducer.java#L53-L89","documentation":"The mailer's CDI producer creates a MailTemplate for an injection point based on the @Location qualifier value, which names the template resource path. If the injection point has no @Location qualifier or the value is empty, the producer cannot resolve a template and throws this IllegalStateException at bean creation time.","triggerScenarios":"Injecting MailTemplate without @Location (e.g. plain @Inject MailTemplate tpl;) or with an empty @Location(\"\") — the producer's get(InjectionPoint, Instance<ReactiveMailer>) method rejects it immediately.","commonSituations":"Forgetting the @Location annotation when adding a mail template injection; refactoring and accidentally emptying the annotation value; programmatic lookup of MailTemplate beans without any Location qualifier.","solutions":["Annotate the injection point with the template resource path: @Inject @Location(\"mails/welcome\") MailTemplate welcome;","Make sure the @Location value is non-empty and matches a file under src/main/resources/templates.","For multiple named templates in one class, use distinct fields each with its own @Location rather than one unqualified injection."],"exampleFix":"// before\n@Inject\nMailTemplate mailTemplate;\n\n// after\n@Inject\n@Location(\"mails/welcome\")\nMailTemplate mailTemplate;","handlingStrategy":"validation","validationCode":"// Compile-time: every MailTemplate injection point must carry @Location\n@Inject @Location(\"mails/welcome\") MailTemplate welcome; // correct pattern","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat @Location as mandatory on every MailTemplate injection point","Search the codebase for 'MailTemplate' injections missing @Location during code review","Keep template paths as constants so typos fail at compile time"],"tags":["quarkus","mailer","cdi","location-qualifier","illegal-state"],"backgroundTag":"missing-annotation-qualifier","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"}