{"record":{"id":"b324b8e113da0cdb","repo":"quarkusio/quarkus","slug":"invalid-build-time-data-key-can-not-be-empty","errorCode":null,"errorMessage":"Invalid build time data key, can not be empty","messagePattern":"Invalid build time data key, can not be empty","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/BuildTimeDataPageBuilder.java","lineNumber":15,"sourceCode":"package io.quarkus.devui.spi.page;\n\npublic abstract class BuildTimeDataPageBuilder<T> extends PageBuilder<T> {\n    private static final String BUILD_TIME_DATA_KEY = \"buildTimeDataKey\";\n\n    protected BuildTimeDataPageBuilder(String title) {\n        super();\n        super.title = title;\n        super.internalComponent = true;// As external page runs on \"internal\" namespace\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public T buildTimeDataKey(String key) {\n        if (key == null || key.isEmpty()) {\n            throw new RuntimeException(\"Invalid build time data key, can not be empty\");\n        }\n        super.metadata.put(BUILD_TIME_DATA_KEY, key);\n        return (T) this;\n    }\n\n}","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/page/BuildTimeDataPageBuilder.java#L1-L21","documentation":"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.","triggerScenarios":"Calling buildTimeDataKey(null) or buildTimeDataKey(\"\") — often when the key is derived from a constant/config value that is empty.","commonSituations":"Programmatic page construction where the key comes from a map lookup or property that resolved to null.","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"],"exampleFix":"// before\nString key = config.value(\"dataKey\"); // may be null\nbuilder.buildTimeDataKey(key);\n// after\nString key = Objects.requireNonNullElse(config.value(\"dataKey\"), \"my-default-data-key\");\nif (key.isEmpty()) { throw new IllegalStateException(\"dataKey must be set\"); }\nbuilder.buildTimeDataKey(key);","handlingStrategy":"validation","validationCode":"if (dataKey == null || dataKey.isEmpty()) {\n    throw new IllegalArgumentException(\"Build-time data key must be non-empty\");\n}","typeGuard":"boolean isValidDataKey(String key) { return key != null && !key.isEmpty(); }","tryCatchPattern":"try {\n    builder.buildTimeDataKey(key);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"Invalid build time data key\")) { /* supply a valid key */ }\n    else throw e;\n}","preventionTips":["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"],"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-14T00:17:10.932Z"}