{"record":{"id":"77ba99778dc30675","repo":"quarkusio/quarkus","slug":"user-message-is-required","errorCode":null,"errorMessage":"User message is required","messagePattern":"User message is required","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/assistant/runtime-dev/src/main/java/io/quarkus/assistant/runtime/dev/Assistant.java","lineNumber":125,"sourceCode":"\n        public AssistBuilder addPath(Path path) {\n            if (path != null) {\n                this.paths.add(path);\n            }\n            return this;\n        }\n\n        public AssistBuilder responseType(Class<?> responseType) {\n            if (responseType != null) {\n                this.responseType = responseType;\n            }\n            return this;\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        public <T> CompletionStage<T> assist() {\n            if (null == userMessage || userMessage.isBlank()) {\n                throw new IllegalStateException(\"User message is required\");\n            }\n            return (CompletionStage<T>) assistant.assist(systemMessage, userMessage, variables, paths, responseType);\n        }\n    }\n\n}\n","sourceCodeStart":107,"sourceCodeEnd":132,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/assistant/runtime-dev/src/main/java/io/quarkus/assistant/runtime/dev/Assistant.java#L107-L132","documentation":"Assistant.RequestBuilder.assist() throws this IllegalStateException when userMessage was never set or is blank. The assistant API requires an actual user prompt to send to the AI backend; delegating with an empty message would be meaningless.","triggerScenarios":"Calling assist() on the builder without calling userMessage(...) or after userMessage(\"\") / whitespace-only input.","commonSituations":"Building requests programmatically where the user input was empty; forgetting to chain userMessage while setting systemMessage/variables/paths; passing optional user text straight through without a check.","solutions":["Call .userMessage(\"...\") with non-blank text before assist()","Guard the call site: only build/assist when user input is non-blank","Surface a validation error to the UI/user instead of invoking the assistant"],"exampleFix":"// before\nassistant.request().systemMessage(sys).assist();\n// after\nif (userInput != null && !userInput.isBlank()) {\n    assistant.request().systemMessage(sys).userMessage(userInput).assist();\n}","handlingStrategy":"validation","validationCode":"if (userInput == null || userInput.isBlank()) {\n    throw new IllegalArgumentException(\"userMessage must be non-blank before calling assist()\");\n}","typeGuard":"boolean hasUserMessage(Assistant.RequestBuilder b, String msg) {\n    return msg != null && !msg.isBlank();\n}","tryCatchPattern":"try {\n    CompletionStage<String> result = builder.assist();\n} catch (IllegalStateException e) {\n    logger.warn(\"No user message provided to assistant\");\n}","preventionTips":["Always chain .userMessage(...) before assist()","Validate user input for blankness in the UI/controller layer before building the request","Write a unit test that assist() without userMessage fails fast"],"tags":["quarkus","assistant","ai","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"}