{"record":{"id":"142d6b437a1f346e","repo":"quarkusio/quarkus","slug":"generatedstaticresourcebuilditem-endpoint-must-not","errorCode":null,"errorMessage":"GeneratedStaticResourceBuildItem endpoint must not end with '/': <endpoint>","messagePattern":"GeneratedStaticResourceBuildItem endpoint must not end with '/': <endpoint>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/vertx-http/deployment-spi/src/main/java/io/quarkus/vertx/http/deployment/spi/GeneratedStaticResourceBuildItem.java","lineNumber":37,"sourceCode":" * and {@link io.quarkus.deployment.builditem.GeneratedResourceBuildItem} build items.\n * <br>\n * The value of {@code endpoint} should be prefixed with {@code '/'} and reference a file (no trailing `/`).\n */\npublic final class GeneratedStaticResourceBuildItem extends MultiBuildItem {\n\n    private final String endpoint;\n\n    private final Path file;\n    private final byte[] content;\n\n    private GeneratedStaticResourceBuildItem(final String endpoint, final byte[] content, final Path file) {\n        requireNonNull(endpoint, \"endpoint is required\");\n        if (!endpoint.startsWith(\"/\")) {\n            throw new IllegalArgumentException(\n                    \"GeneratedStaticResourceBuildItem endpoint must start with '/': %s\".formatted(endpoint));\n        }\n        if (endpoint.endsWith(\"/\")) {\n            throw new IllegalArgumentException(\n                    \"GeneratedStaticResourceBuildItem endpoint must not end with '/': %s\".formatted(endpoint));\n        }\n        this.endpoint = endpoint;\n        this.file = file;\n        this.content = content;\n    }\n\n    /**\n     * The resource will be served at {@code '{quarkus.http.root-path}{endpoint}'}\n     *\n     * @param endpoint the endpoint from the {@code '{quarkus.http.root-path}'} for this generated static resource. It should be\n     *        prefixed with {@code '/'}\n     * @param content the content of this generated static resource\n     */\n    public GeneratedStaticResourceBuildItem(final String endpoint, final byte[] content) {\n        this(endpoint, content, null);\n    }\n","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx-http/deployment-spi/src/main/java/io/quarkus/vertx/http/deployment/spi/GeneratedStaticResourceBuildItem.java#L19-L55","documentation":"GeneratedStaticResourceBuildItem rejects endpoints that end with '/' because resource endpoints map to concrete files, not directories; a trailing slash would create an ambiguous/invalid route. The constructor throws IllegalArgumentException in that case.","triggerScenarios":"Constructing GeneratedStaticResourceBuildItem with an endpoint like \"/assets/\" — e.g. derived from a directory path or a URL that kept its trailing slash.","commonSituations":"Passing directory-style paths from config; copying a route prefix (which may end in '/') into a resource endpoint; trimming the filename but leaving the separator.","solutions":["Strip the trailing '/' from the endpoint before constructing the item","Normalize both leading and trailing slashes in one place when generating endpoints","Ensure the endpoint always points to a concrete resource path"],"exampleFix":"// before\nString ep = \"/assets/index.html/\";\nnew GeneratedStaticResourceBuildItem(ep, content)\n// after\nif (ep.endsWith(\"/\")) { ep = ep.substring(0, ep.length() - 1); }\nnew GeneratedStaticResourceBuildItem(ep, content)","handlingStrategy":"validation","validationCode":"if (endpoint != null && endpoint.endsWith(\"/\")) {\n    endpoint = endpoint.substring(0, endpoint.length() - 1);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip trailing slashes when deriving endpoints from directories or URLs","Use a single normalizeEndpoint helper for all resource build items","Test generated endpoints for both slash rules"],"tags":["build-time","validation","path","argument-illegal"],"backgroundTag":"invalid-path-format","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"}