{"record":{"id":"6b6c3b2fb1785fa3","repo":"quarkusio/quarkus","slug":"invalid-template","errorCode":null,"errorMessage":"Invalid template","messagePattern":"Invalid template","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java","lineNumber":76,"sourceCode":"        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        }\n\n        public Builder addData(String key, Object value) {\n            this.data.put(key, value);\n            return this;\n        }\n\n        public Builder descriptions(Map<String, String> descriptions) {\n            this.descriptions = descriptions;","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java#L58-L94","documentation":"DevUIContent.Builder.template(byte[]) throws this when the template byte array is null or empty. The builder requires actual template bytes because the Dev UI page content is generated from this template at build time; a null/empty template would produce a broken page.","triggerScenarios":"Calling DevUIContent.builder().template(null) or template(new byte[0]) — typically when the resource loaded into a byte[] was missing, so the variable passed was null.","commonSituations":"A classpath resource was read with IO.classPaths... or InputStream that returned null because the HTML/JS file path was misspelled or the file was not included in the deployment module.","solutions":["Check the byte[] passed to template() is non-null and non-empty before calling it; log it if unsure","Verify the template resource exists on the deployment module classpath and the path is correct","If you don't need a custom template, omit template() and let build() use DEFAULT_TEMPLATE"],"exampleFix":"// before\nbyte[] tpl = loadResourceOrNull(\"my-page.html\");\nDevUIContent.builder().fileName(\"my-page.html\").template(tpl).build();\n// after\nbyte[] tpl = loadResourceOrNull(\"my-page.html\");\nif (tpl == null || tpl.length == 0) {\n    throw new IllegalStateException(\"Template resource my-page.html missing on classpath\");\n}\nDevUIContent.builder().fileName(\"my-page.html\").template(tpl).build();","handlingStrategy":"validation","validationCode":"if (templateBytes == null || templateBytes.length == 0) {\n    throw new IllegalArgumentException(\"DevUI template bytes must be non-null and non-empty\");\n}","typeGuard":"boolean isValidTemplate(byte[] t) { return t != null && t.length > 0; }","tryCatchPattern":"try {\n    builder.template(bytes);\n} catch (RuntimeException e) {\n    if (\"Invalid template\".equals(e.getMessage())) { /* fall back to default template */ }\n    else throw e;\n}","preventionTips":["Load templates via a helper that fails fast with the resource path in the message","Omit template() when the default template suffices","Add a unit test asserting the template resource exists on the classpath"],"tags":["quarkus","devui","builder-validation"],"backgroundTag":"empty-required-value","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"}