{"record":{"id":"0e03c1294f3e1be3","repo":"quarkusio/quarkus","slug":"generatedstaticresourcebuilditem-endpoint-must-sta","errorCode":null,"errorMessage":"GeneratedStaticResourceBuildItem endpoint must start with '/': <endpoint>","messagePattern":"GeneratedStaticResourceBuildItem endpoint must start 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":33,"sourceCode":" * file on disk.\n * <br>\n * Behind the scenes the build step will take care of add those resources to the final build, through\n * {@link AdditionalStaticResourceBuildItem}, {@link NativeImageResourceBuildItem}\n * 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     */","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/vertx-http/deployment-spi/src/main/java/io/quarkus/vertx/http/deployment/spi/GeneratedStaticResourceBuildItem.java#L15-L51","documentation":"GeneratedStaticResourceBuildItem's constructor validates that the endpoint path is absolute; an endpoint not starting with '/' is rejected with this IllegalArgumentException at build time. Endpoints are HTTP paths, so a leading slash is mandatory.","triggerScenarios":"A BuildStep creates new GeneratedStaticResourceBuildItem(endpoint, content) or the file-based variant where endpoint is a relative path like \"foo/bar.js\" or an empty-after-null-check string.","commonSituations":"Building the path by string concatenation from a config value or artifact id without prepending '/'; stripping the leading slash when normalizing paths; producing a dev-ui or webjar route from a filename.","solutions":["Prepend '/' to the endpoint before constructing the build item","Normalize the path in a helper that ensures a leading slash","Add a validation guard in the producing build step"],"exampleFix":"// before\nnew GeneratedStaticResourceBuildItem(\"assets/app.js\", content)\n// after\nnew GeneratedStaticResourceBuildItem(\"/assets/app.js\", content)","handlingStrategy":"validation","validationCode":"if (endpoint == null || !endpoint.startsWith(\"/\")) {\n    throw new IllegalArgumentException(\"endpoint must start with '/': \" + endpoint);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always prefix generated endpoints with '/'","Normalize paths in one helper before creating build items","Assert endpoints start with '/' in build-step tests"],"tags":["build-time","validation","path","argument-illegal"],"backgroundTag":"path-must-be-absolute","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"}