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
- Pass a non-empty constant key, e.g. buildTimeDataKey("my-extension-data")
- 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
- Use compile-time constants for data keys instead of dynamic lookups
- Validate config-derived keys before passing them
- Prefix keys with the extension name for uniqueness
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
- Invalid template
- FileName is mandatory, for example 'index.html'
- Only one of runtimeValue, function or assistantFunction is a
- methodName must be provided
- Either function, assistantFunction or runtimeValue must be p
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/b324b8e113da0cdb.
Report an issue: GitHub.