{"record":{"id":"76ab32cca0a3211e","repo":"quarkusio/quarkus","slug":"you-have-to-specify-usermessage-that-will-be-send","errorCode":null,"errorMessage":"You have to specify userMessage that will be send to AI, or implement your own using the function","messagePattern":"You have to specify userMessage that will be send to AI, or implement your own using the 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":125,"sourceCode":"            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    }\n\n    public String getDescription() {\n        return consoleCommand != null ? consoleCommand.getDescription() : description;\n    }\n\n    public char getKey() {\n        return key;\n    }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/assistant/deployment-spi/src/main/java/io/quarkus/assistant/deployment/spi/AssistantConsoleBuildItem.java#L107-L143","documentation":"AssistantConsoleBuildItem.Builder.build() requires either a userMessage (sent to the AI) or a custom function implementation; if userMessage is null and function is empty it throws this IllegalStateException. The build item must define what happens when the user triggers the console entry.","triggerScenarios":"Building an AssistantConsoleBuildItem with key and description set but neither userMessage(...) nor function(...) called.","commonSituations":"Extension authors scaffolding a console entry and planning to fill in the AI prompt later; switching between userMessage and function styles and dropping both.","solutions":["Call .userMessage(\"...\") with the prompt to send to the AI, or","Call .function(...) with a custom implementation (e.g. a BiConsumer/Function handling the request yourself)"],"exampleFix":"// before\nnew AssistantConsoleBuildItem.Builder()\n    .key('e').description(\"Explain\")\n    .build();\n// after\nnew AssistantConsoleBuildItem.Builder()\n    .key('e').description(\"Explain\")\n    .userMessage(\"Explain this build error\")\n    .build();","handlingStrategy":"validation","validationCode":"if (userMessage == null && function.isEmpty()) {\n    throw new IllegalArgumentException(\"Provide userMessage or function for the assistant console entry\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    AssistantConsoleBuildItem item = builder.build();\n} catch (IllegalStateException e) {\n    logger.error(\"Set userMessage(...) or function(...) on the builder\", e);\n}","preventionTips":["Decide per console entry whether it is AI-prompt-based (userMessage) or custom (function) and set exactly one","Never build a console item with only key and description","Centralize console-entry creation so required fields cannot be skipped"],"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"}