quarkusio/quarkus · error · RuntimeException

Invalid fileName

Error message

Invalid fileName

What it means

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.

Source

Thrown at extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/DevUIContent.java:68

    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private String fileName;
        private byte[] template;
        private Map<String, Object> data;
        private Map<String, String> descriptions;
        private Map<String, String> contentTypes;
        private Map<String, String> mcpDefaultEnabled;

        private Builder() {
            this.data = new HashMap<>();
        }

        public Builder fileName(String fileName) {
            if (fileName == null || fileName.isEmpty()) {
                throw new RuntimeException("Invalid fileName");
            }
            this.fileName = fileName;
            return this;
        }

        public Builder template(byte[] template) {
            if (template == null || template.length == 0) {
                throw new RuntimeException("Invalid template");
            }

            this.template = template;
            return this;
        }

        public Builder addData(Map<String, Object> data) {
            this.data.putAll(data);
            return this;
        }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pass a non-empty file name to DevUIContent.Builder.fileName(), e.g. fileName("my-page.html").
  2. Verify the variable feeding the call is initialized and non-empty before building the content.
  3. Check the resource actually exists in the extension's runtime module resources if the name is derived from a template path.
  4. Add a unit test for the build step to catch empty names before deployment processing.

Example fix

// before
String file = getConfigValue("page.file"); // resolves to ""
DevUIContent.builder().route("my-page").fileName(file).build();

// after
String file = getConfigValue("page.file");
if (file == null || file.isEmpty()) { file = "my-page.html"; }
DevUIContent.builder().route("my-page").fileName(file).build();
Defensive patterns

Strategy: validation

Validate before calling

if (fileName == null || fileName.isEmpty()) {
    throw new IllegalStateException("DevUIContent requires a non-empty fileName");
}
DevUIContent.builder().route(route).fileName(fileName).build();

Try / catch

try { DevUIContent c = builder.build(); ... }
catch (RuntimeException e) {
    if (e.getMessage().equals("Invalid fileName")) {
        throw new IllegalStateException("Extension bug: DevUIContent fileName not set", e);
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/d05f562220b82c60. Report an issue: GitHub.