{"record":{"id":"b911a75eef66b565","repo":"quarkusio/quarkus","slug":"you-have-to-specify-a-key-this-is-the-key-the-use","errorCode":null,"errorMessage":"You have to specify a key. This is the key the user will press to get to your function","messagePattern":"You have to specify a key\\. This is the key the user will press to get to your function","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/assistant/deployment-spi/src/main/java/io/quarkus/assistant/deployment/spi/AssistantConsoleBuildItem.java","lineNumber":117,"sourceCode":"\n        public Builder stateSupplier(Supplier<String> stateSupplier) {\n            this.stateSupplier = stateSupplier;\n            return this;\n        }\n\n        public Builder variables(Map<String, String> variables) {\n            this.variables = variables;\n            return this;\n        }\n\n        public Builder function(Function<Assistant, CompletionStage<?>> function) {\n            this.function = Optional.of(function);\n            return this;\n        }\n\n        public AssistantConsoleBuildItem build() {\n            if (key == Character.MIN_VALUE) {\n                throw new IllegalStateException(\n                        \"You have to specify a key. This is the key the user will press to get to your function\");\n            }\n            if (description == null || description.isBlank()) {\n                throw new IllegalStateException(\n                        \"You have to specify a description. This is what the user will see in the console menu\");\n            }\n            if (userMessage == null && !function.isPresent()) {\n                throw new IllegalStateException(\n                        \"You have to specify userMessage that will be send to AI, or implement your own using the function\");\n            }\n\n            return new AssistantConsoleBuildItem(this);\n        }\n    }\n\n    public ConsoleCommand getConsoleCommand() {\n        return consoleCommand;\n    }","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/assistant/deployment-spi/src/main/java/io/quarkus/assistant/deployment/spi/AssistantConsoleBuildItem.java#L99-L135","documentation":"AssistantConsoleBuildItem.Builder.build() validates that a console key character was set; if key still equals Character.MIN_VALUE it throws this IllegalStateException. Every assistant console entry must define the hotkey character the user presses to reach its function in the Dev UI console menu.","triggerScenarios":"Building an AssistantConsoleBuildItem without calling key(char) on the builder.","commonSituations":"Extension authors adding an assistant console shortcut who configure description/userMessage but forget the key; refactoring away the key setter.","solutions":["Call .key('x') on the builder with the hotkey character before build()","Ensure the chosen key does not collide with other console entries"],"exampleFix":"// before\nAssistantConsoleBuildItem item = new AssistantConsoleBuildItem.Builder()\n    .description(\"Explain build\")\n    .userMessage(\"Explain\")\n    .build();\n// after\nAssistantConsoleBuildItem item = new AssistantConsoleBuildItem.Builder()\n    .key('e')\n    .description(\"Explain build\")\n    .userMessage(\"Explain\")\n    .build();","handlingStrategy":"validation","validationCode":"Builder b = new AssistantConsoleBuildItem.Builder()...;\nif (b.key == Character.MIN_VALUE) throw new IllegalArgumentException(\"key is required\");","typeGuard":null,"tryCatchPattern":"try {\n    AssistantConsoleBuildItem item = builder.build();\n} catch (IllegalStateException e) {\n    logger.error(\"Set key(char) on the AssistantConsoleBuildItem builder\", e);\n}","preventionTips":["Always chain .key('x') when building console entries","Use a shared builder helper that enforces key, description, and message together","Pick distinct keys to avoid console collisions"],"tags":["quarkus","assistant","devui","build-item","validation"],"backgroundTag":"missing-required-argument","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"}