quarkusio/quarkus · error · RuntimeException

Invalid build time data key, can not be empty

Error message

Invalid build time data key, can not be empty

What it means

BuildTimeDataPageBuilder.buildTimeDataKey(String) throws this when the key is null or empty. The key identifies the build-time data map injected into the page's front-end, so an empty key is unusable.

Source

Thrown at extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/BuildTimeDataPageBuilder.java:15

package io.quarkus.devui.spi.page;

public abstract class BuildTimeDataPageBuilder<T> extends PageBuilder<T> {
    private static final String BUILD_TIME_DATA_KEY = "buildTimeDataKey";

    protected BuildTimeDataPageBuilder(String title) {
        super();
        super.title = title;
        super.internalComponent = true;// As external page runs on "internal" namespace
    }

    @SuppressWarnings("unchecked")
    public T buildTimeDataKey(String key) {
        if (key == null || key.isEmpty()) {
            throw new RuntimeException("Invalid build time data key, can not be empty");
        }
        super.metadata.put(BUILD_TIME_DATA_KEY, key);
        return (T) this;
    }

}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Pass a non-empty constant key, e.g. buildTimeDataKey("my-extension-data")
  2. If the key is dynamic, assert it is non-empty before calling

Example fix

// before
String key = config.value("dataKey"); // may be null
builder.buildTimeDataKey(key);
// after
String key = Objects.requireNonNullElse(config.value("dataKey"), "my-default-data-key");
if (key.isEmpty()) { throw new IllegalStateException("dataKey must be set"); }
builder.buildTimeDataKey(key);
Defensive patterns

Strategy: validation

Validate before calling

if (dataKey == null || dataKey.isEmpty()) {
    throw new IllegalArgumentException("Build-time data key must be non-empty");
}

Type guard

boolean isValidDataKey(String key) { return key != null && !key.isEmpty(); }

Try / catch

try {
    builder.buildTimeDataKey(key);
} catch (RuntimeException e) {
    if (e.getMessage().contains("Invalid build time data key")) { /* supply a valid key */ }
    else throw e;
}

Prevention

When it happens

Trigger: Calling buildTimeDataKey(null) or buildTimeDataKey("") — often when the key is derived from a constant/config value that is empty.

Common situations: Programmatic page construction where the key comes from a map lookup or property that resolved to null.

Related errors


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