{"record":{"id":"ab663ff52751bd94","repo":"quarkusio/quarkus","slug":"key-key-not-found","errorCode":null,"errorMessage":"Key ${key} not found","messagePattern":"Key (.+?) not found","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/runtime/src/main/java/io/quarkus/runtime/ValueRegistryImpl.java","lineNumber":64,"sourceCode":"        }\n        if (runtimeInfo == null) {\n            throw new IllegalArgumentException(\"Value cannot be null\");\n        }\n        RuntimeInfo<?> mapValue = values.putIfAbsent(key.key(), runtimeInfo);\n        if (mapValue != null) {\n            throw new IllegalArgumentException(\"Key already registered \" + key.key());\n        }\n    }\n\n    public <T> boolean containsKey(final RuntimeKey<T> key) {\n        return values.containsKey(key.key());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public <T> T get(final RuntimeKey<T> key) {\n        RuntimeInfo<T> runtimeInfo = (RuntimeInfo<T>) values.get(key.key());\n        if (runtimeInfo == null) {\n            throw new IllegalArgumentException(\"Key \" + key.key() + \" not found\");\n        }\n        return runtimeInfo.get(this);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public <T> T getOrDefault(final RuntimeKey<T> key, final T defaultValue) {\n        RuntimeInfo<T> runtimeInfo = (RuntimeInfo<T>) values.get(key.key());\n        return runtimeInfo == null ? defaultValue : runtimeInfo.get(this);\n    }\n\n    @Override\n    public RuntimeInfo<?> get(final String key) {\n        return values.get(key);\n    }\n\n    public static Builder builder() {\n        return new Builder();\n    }","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/runtime/src/main/java/io/quarkus/runtime/ValueRegistryImpl.java#L46-L82","documentation":"Thrown by ValueRegistryImpl.get when a recorder asks for a RuntimeValue whose RuntimeKey was never registered via register(). During STATIC_INIT, recorders create and register values into the ValueRegistry held by the StartupContext; get() later retrieves them by key. A miss means the producing recorder never ran, ran after the consumer, or the key instance does not match the one used at registration time.","triggerScenarios":"Calling get(key) before the corresponding register() ran, with a mistyped key constant, or on a registry instance other than the one that was populated.","commonSituations":"Ordering problem where consumer code runs before the producer registration; extension removed/renamed so its key is no longer registered; config for a feature disabled so registration was skipped.","solutions":["Use getOrDefault(key, default) instead of get() when absence is acceptable.","Ensure the registering code path actually ran before the lookup (check ordering/startup phases).","Verify the exact same RuntimeKey instance/string is used for register and get.","Check containsKey() first and handle absence explicitly."],"exampleFix":"// before\nint size = registry.get(MyKeys.POOL_SIZE); // throws if never registered\n// after\nint size = registry.getOrDefault(MyKeys.POOL_SIZE, 10);","handlingStrategy":"fallback","validationCode":"if (registry.containsKey(key)) {\n    value = registry.get(key);\n} else {\n    value = defaultValue;\n}","typeGuard":"boolean isAvailable(ValueRegistryImpl registry, RuntimeKey<?> key) {\n    return key != null && registry.containsKey(key);\n}","tryCatchPattern":"try {\n    value = registry.get(key);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().endsWith(\"not found\")) {\n        value = defaultValue;\n    } else { throw e; }\n}","preventionTips":["Use getOrDefault whenever absence is acceptable","Verify registration ordering (producer before consumer)","Share the same registry instance and identical RuntimeKey constants"],"tags":["missing-key","registry","lookup"],"backgroundTag":"key-not-found","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"}