{"record":{"id":"d05f562220b82c60","repo":"quarkusio/quarkus","slug":"invalid-filename","errorCode":null,"errorMessage":"Invalid fileName","messagePattern":"Invalid fileName","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java","lineNumber":68,"sourceCode":"    public static Builder builder() {\n        return new Builder();\n    }\n\n    public static class Builder {\n        private String fileName;\n        private byte[] template;\n        private Map<String, Object> data;\n        private Map<String, String> descriptions;\n        private Map<String, String> contentTypes;\n        private Map<String, String> mcpDefaultEnabled;\n\n        private Builder() {\n            this.data = new HashMap<>();\n        }\n\n        public Builder fileName(String fileName) {\n            if (fileName == null || fileName.isEmpty()) {\n                throw new RuntimeException(\"Invalid fileName\");\n            }\n            this.fileName = fileName;\n            return this;\n        }\n\n        public Builder template(byte[] template) {\n            if (template == null || template.length == 0) {\n                throw new RuntimeException(\"Invalid template\");\n            }\n\n            this.template = template;\n            return this;\n        }\n\n        public Builder addData(Map<String, Object> data) {\n            this.data.putAll(data);\n            return this;\n        }","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java#L50-L86","documentation":"DevUIContent.Builder builds content descriptors (page route, filename, template data) that extensions use to add Dev UI pages. The fileName method validates its argument and throws RuntimeException when fileName is null or empty, since the content entry cannot be resolved to a file without it. This fails fast at extension (deployment) build time.","triggerScenarios":"An extension's build step constructs a DevUIContent.Builder and calls fileName(null), fileName(\"\"), or omits supplying a real value derived from a variable that is null/empty.","commonSituations":"Extension authors wiring the filename from config or a constant that resolves to empty; a typo passing the wrong variable; copying builder code and forgetting to set the value; refactors that removed the default filename.","solutions":["Pass a non-empty file name to DevUIContent.Builder.fileName(), e.g. fileName(\"my-page.html\").","Verify the variable feeding the call is initialized and non-empty before building the content.","Check the resource actually exists in the extension's runtime module resources if the name is derived from a template path.","Add a unit test for the build step to catch empty names before deployment processing."],"exampleFix":"// before\nString file = getConfigValue(\"page.file\"); // resolves to \"\"\nDevUIContent.builder().route(\"my-page\").fileName(file).build();\n\n// after\nString file = getConfigValue(\"page.file\");\nif (file == null || file.isEmpty()) { file = \"my-page.html\"; }\nDevUIContent.builder().route(\"my-page\").fileName(file).build();","handlingStrategy":"validation","validationCode":"if (fileName == null || fileName.isEmpty()) {\n    throw new IllegalStateException(\"DevUIContent requires a non-empty fileName\");\n}\nDevUIContent.builder().route(route).fileName(fileName).build();","typeGuard":null,"tryCatchPattern":"try { DevUIContent c = builder.build(); ... }\ncatch (RuntimeException e) {\n    if (e.getMessage().equals(\"Invalid fileName\")) {\n        throw new IllegalStateException(\"Extension bug: DevUIContent fileName not set\", e);\n    } else throw e;\n}","preventionTips":["Set fileName with a compile-time constant, not a nullable variable","Add a unit test asserting the built DevUIContent has a non-empty fileName","Verify the referenced resource exists in the runtime module"],"tags":["devui","extension-development","validation","build-time"],"backgroundTag":"missing-required-argument","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}