alibaba/nacos · error · IllegalArgumentException

Skill name is required

Error message

Skill name is required

What it means

Thrown by SkillOptimizationForm.validate() when the `skill` object is non-null but its `name` field is blank. This is the second check in the validate() chain (after the null-skill check). A Skill without a name cannot be identified or optimized, so the form rejects it.

Source

Thrown at copilot/src/main/java/com/alibaba/nacos/copilot/form/SkillOptimizationForm.java:69

     */
    private ConversationHistory conversationHistory;
    
    /**
     * Target file name to optimize (optional).
     * If specified, only optimize the content of this specific file.
     * If not specified, optimize the entire Skill.
     */
    private String targetFileName;
    
    /**
     * Validate form data.
     */
    public void validate() {
        if (skill == null) {
            throw new IllegalArgumentException("Skill is required");
        }
        if (StringUtils.isBlank(skill.getName())) {
            throw new IllegalArgumentException("Skill name is required");
        }
    }
    
    public Skill getSkill() {
        return skill;
    }
    
    public void setSkill(Skill skill) {
        this.skill = skill;
    }
    
    public String getOptimizationGoal() {
        return optimizationGoal;
    }
    
    public void setOptimizationGoal(String optimizationGoal) {
        this.optimizationGoal = optimizationGoal;
    }

View on GitHub (pinned to 9b989acdf1)

Solutions

  1. Ensure the skill object has a non-blank `name` field before posting.
  2. Populate the name when constructing/loading the Skill model.
  3. Validate the skill structure client-side before enabling optimize.

Example fix

// before
body: JSON.stringify({ skill: currentSkill, optimizationGoal })

// after
if (!currentSkill?.name?.trim()) {
  setError('Skill name is missing');
  return;
}
body: JSON.stringify({ skill: currentSkill, optimizationGoal })
Defensive patterns

Strategy: validation

Validate before calling

function skillHasName(skill: { name?: string } | null | undefined): boolean {
  return !!skill && typeof skill.name === 'string' && skill.name.trim().length > 0;
}

Type guard

function isNamedSkill(value: unknown): value is { name: string } {
  return value !== null && typeof value === 'object'
    && typeof (value as any).name === 'string' && (value as any).name.trim().length > 0;
}

Prevention

When it happens

Trigger: Posting to /v3/console/copilot/skill/optimize with a skill object whose getName() returns null, empty, or whitespace. The skill object itself is present but malformed/incomplete.

Common situations: Skill loaded from a partial source missing the name field. Client constructs a Skill object without setting the name. Name field deserialized as null from JSON missing 'name'.

Related errors


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