{"record":{"id":"dde153e4ec3cec80","repo":"alibaba/nacos","slug":"user-input-is-required","errorCode":null,"errorMessage":"User input is required","messagePattern":"User input is required","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":400,"severity":"error","filePath":"copilot/src/main/java/com/alibaba/nacos/copilot/form/PromptDebugForm.java","lineNumber":48,"sourceCode":"     * This is the prompt template that defines the AI's behavior.\n     */\n    private String prompt;\n    \n    /**\n     * User input content (required).\n     * This is the user's message to test with the prompt.\n     */\n    private String userInput;\n    \n    /**\n     * Validate form data.\n     */\n    public void validate() {\n        if (StringUtils.isBlank(prompt)) {\n            throw new IllegalArgumentException(\"Prompt is required\");\n        }\n        if (StringUtils.isBlank(userInput)) {\n            throw new IllegalArgumentException(\"User input is required\");\n        }\n    }\n    \n    public String getPrompt() {\n        return prompt;\n    }\n    \n    public void setPrompt(String prompt) {\n        this.prompt = prompt;\n    }\n    \n    public String getUserInput() {\n        return userInput;\n    }\n    \n    public void setUserInput(String userInput) {\n        this.userInput = userInput;\n    }","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/copilot/src/main/java/com/alibaba/nacos/copilot/form/PromptDebugForm.java#L30-L66","documentation":"Thrown by PromptDebugForm.validate() when the `userInput` field is null, empty, or whitespace-only. The userInput is the test message sent against the prompt template; without it there is nothing to debug. The controller surfaces this as an SSE error event.","triggerScenarios":"Posting to /v3/console/copilot/prompt/debug with userInput omitted, null, empty, or whitespace. The front-end handler does guard `if (!userInput.trim()) return;` but a programmatic caller can bypass that.","commonSituations":"User clicks debug without typing a test message. Programmatic API call omitting userInput. userInput field cleared by a form reset.","solutions":["Provide a non-blank `userInput` string in the request body.","Keep the client-side guard (disable debug when userInput is empty) and mirror it for API clients.","Validate the request payload before posting to the SSE endpoint."],"exampleFix":"// before\nbody: JSON.stringify({ prompt: renderedPrompt, userInput })\n\n// after\nif (!userInput.trim()) {\n  setDebugError('Please enter a test message');\n  return;\n}\nbody: JSON.stringify({ prompt: renderedPrompt, userInput })","handlingStrategy":"validation","validationCode":"function hasUserInput(userInput: unknown): boolean {\n  return typeof userInput === 'string' && userInput.trim().length > 0;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include a non-blank userInput in the debug request body.","Disable the debug action when the test message field is empty.","Mirror the client-side trim guard in any API client."],"tags":["copilot","prompt-debug","java","validation","form"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}