{"record":{"id":"7b76372fae22047d","repo":"quarkusio/quarkus","slug":"filename-is-mandatory-for-example-index-html","errorCode":null,"errorMessage":"FileName is mandatory, for example 'index.html'","messagePattern":"FileName is mandatory, for example 'index\\.html'","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java","lineNumber":110,"sourceCode":"\n        public Builder descriptions(Map<String, String> descriptions) {\n            this.descriptions = descriptions;\n            return this;\n        }\n\n        public Builder mcpDefaultEnables(Map<String, String> mcpDefaultEnabled) {\n            this.mcpDefaultEnabled = mcpDefaultEnabled;\n            return this;\n        }\n\n        public Builder contentTypes(Map<String, String> contentTypes) {\n            this.contentTypes = contentTypes;\n            return this;\n        }\n\n        public DevUIContent build() {\n            if (fileName == null) {\n                throw new RuntimeException(\n                        ERROR + \" FileName is mandatory, for example 'index.html'\");\n            }\n\n            if (template == null) {\n                template = DEFAULT_TEMPLATE;\n            }\n\n            return new DevUIContent(this);\n        }\n\n        private static final String ERROR = \"Not enough information to create Dev UI content.\";\n        private static final byte[] DEFAULT_TEMPLATE = \"Here the template of your page. Set your own by providing the template() in the DevUIContent\"\n                .getBytes();\n    }\n}\n","sourceCodeStart":92,"sourceCodeEnd":126,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java#L92-L126","documentation":"Thrown by DevUIContent.Builder.build when a Dev UI extension content contribution is finalized without a file name. The builder pattern lets extension authors register static content for the Dev UI; fileName (e.g. 'index.html') is the mandatory identifier used to serve the contribution, and the guard fires at build time when the developer forgot to call fileName(...) before build().","triggerScenarios":"Calling DevUIContent.builder().template(...).build() without calling fileName(String) first.","commonSituations":"Copy-pasting a new Dev UI content registration from an example and forgetting the fileName line, or refactoring a builder chain and dropping the call.","solutions":["Add .fileName(\"your-page.html\") to the builder chain before build()","Ensure fileName includes an extension, e.g. index.html"],"exampleFix":"// before\nDevUIContent.builder()\n    .template(templateBytes)\n    .build();\n// after\nDevUIContent.builder()\n    .fileName(\"index.html\")\n    .template(templateBytes)\n    .build();","handlingStrategy":"validation","validationCode":"if (fileName == null || fileName.isBlank()) {\n    throw new IllegalArgumentException(\"DevUIContent fileName is required, e.g. 'index.html'\");\n}","typeGuard":"boolean hasFileName(DevUIContent.Builder b) { return b != null; } // no public accessor; validate the string before passing","tryCatchPattern":"try {\n    content = builder.build();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"FileName is mandatory\")) { /* set fileName and retry */ }\n    else throw e;\n}","preventionTips":["Always build Dev UI content chains with fileName as the first call","Use a shared factory method that enforces fileName","Review builder chains in code review for mandatory fields"],"tags":["quarkus","devui","builder-validation"],"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"}