alibaba/nacos · error · IllegalArgumentException

User input is required

Error message

User input is required

What it means

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.

Source

Thrown at copilot/src/main/java/com/alibaba/nacos/copilot/form/PromptDebugForm.java:48

     * This is the prompt template that defines the AI's behavior.
     */
    private String prompt;
    
    /**
     * User input content (required).
     * This is the user's message to test with the prompt.
     */
    private String userInput;
    
    /**
     * Validate form data.
     */
    public void validate() {
        if (StringUtils.isBlank(prompt)) {
            throw new IllegalArgumentException("Prompt is required");
        }
        if (StringUtils.isBlank(userInput)) {
            throw new IllegalArgumentException("User input is required");
        }
    }
    
    public String getPrompt() {
        return prompt;
    }
    
    public void setPrompt(String prompt) {
        this.prompt = prompt;
    }
    
    public String getUserInput() {
        return userInput;
    }
    
    public void setUserInput(String userInput) {
        this.userInput = userInput;
    }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Provide a non-blank `userInput` string in the request body.
  2. Keep the client-side guard (disable debug when userInput is empty) and mirror it for API clients.
  3. Validate the request payload before posting to the SSE endpoint.

Example fix

// before
body: JSON.stringify({ prompt: renderedPrompt, userInput })

// after
if (!userInput.trim()) {
  setDebugError('Please enter a test message');
  return;
}
body: JSON.stringify({ prompt: renderedPrompt, userInput })
Defensive patterns

Strategy: validation

Validate before calling

function hasUserInput(userInput: unknown): boolean {
  return typeof userInput === 'string' && userInput.trim().length > 0;
}

Prevention

When it happens

Trigger: 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.

Common situations: User clicks debug without typing a test message. Programmatic API call omitting userInput. userInput field cleared by a form reset.

Related errors


AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14). Data as JSON: /api/errors/dde153e4ec3cec80. Report an issue: GitHub.