{"record":{"id":"e3c50a1be1e3b892","repo":"quarkusio/quarkus","slug":"unknown-mailer-name","errorCode":null,"errorMessage":"Unknown mailer \" + name","messagePattern":"Unknown mailer \" \\+ name","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"integration-tests/mailer/src/main/java/io/quarkus/it/mailer/MailResource.java","lineNumber":52,"sourceCode":"    @MailerName(\"tls-registry\")\n    Mailer tlsRegistryMailer;\n\n    @MailerName(\"tls-registry-trust-all\")\n    Mailer tlsRegistryMailerWithTrustAll;\n\n    @MailerName(\"custom-credentials-provider\")\n    Mailer mailerWithCustomCredentialsProvider;\n\n    private Mailer select(String name) {\n        if (name == null) {\n            return defaultMailer;\n        }\n        return switch (name) {\n            case \"start-tls-registry\" -> startTlsRegistryMailer;\n            case \"start-tls-registry-trust-all\" -> startTlsRegistryMailerWithTrustAll;\n            case \"tls-registry\" -> tlsRegistryMailer;\n            case \"tls-registry-trust-all\" -> tlsRegistryMailerWithTrustAll;\n            default -> throw new IllegalArgumentException(\"Unknown mailer \" + name);\n        };\n    }\n\n    @Inject\n    Vertx vertx;\n\n    @CheckedTemplate\n    static class Templates {\n        public static native MailTemplate.MailTemplateInstance hello(String name);\n    }\n\n    /**\n     * Send a simple text email.\n     */\n    @GET\n    @Path(\"/text\")\n    public String sendSimpleTextEmail() {\n        return sendSimpleTextEmailWithCustomMailer(null);","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/integration-tests/mailer/src/main/java/io/quarkus/it/mailer/MailResource.java#L34-L70","documentation":"MailResource.select() maps a mailer name taken from a request path/query parameter to one of four injected Mailer instances (TLS-registry variants with and without trust-all). If the name matches none of the known cases, the switch's default branch throws IllegalArgumentException('Unknown mailer ' + name). This is an application-level routing guard protecting against requests naming a mailer the test resource does not expose.","triggerScenarios":"Calling any endpoint of MailResource (e.g. /mailer/send/{name}) with a name other than 'start-tls-registry', 'start-tls-registry-trust-all', 'tls-registry', or 'tls-registry-trust-all' — e.g. a typo like 'tls-registry-trustall', an old name like 'default', or an empty/missing parameter.","commonSituations":"Hand-crafted curl/browser requests to the integration-test endpoint; renaming mailers in the resource but not updating test clients or documentation; case-sensitivity mistakes ('TLS-Registry'); copy-pasting an endpoint path from a different test application.","solutions":["Use one of the supported names: start-tls-registry, start-tls-registry-trust-all, tls-registry, tls-registry-trust-all","Check the name for typos and exact kebab-case spelling/case","Inspect MailResource.java to see the currently registered mailer instances injected via @Inject","If a new mailer variant is needed, add an injected Mailer field and a new case in the switch"],"exampleFix":"// before\ncurl http://localhost:8080/mailer/send/tls-trust-all\n// after\ncurl http://localhost:8080/mailer/send/tls-registry-trust-all","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID_MAILERS = Set.of(\n    \"start-tls-registry\", \"start-tls-registry-trust-all\",\n    \"tls-registry\", \"tls-registry-trust-all\");\n\nif (!VALID_MAILERS.contains(name)) {\n    throw new WebApplicationException(\n        Response.status(400).entity(\"Unknown mailer: \" + name).build());\n}","typeGuard":null,"tryCatchPattern":"try {\n    mailer = select(name);\n} catch (IllegalArgumentException e) {\n    return Response.status(Response.Status.BAD_REQUEST)\n        .entity(\"Unknown mailer: \" + name).build();\n}","preventionTips":["Keep the set of valid mailer names as a shared constant used by both tests and the resource","Return HTTP 400 with a list of valid names instead of leaking IllegalArgumentException as a 500","Add a test asserting the rejection message lists valid options","Validate the path parameter with a JAX-RS @Pattern annotation before it reaches select()"],"tags":["rest","illegal-argument","mailer","integration-test"],"backgroundTag":"unknown-mailer-name","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"}