alibaba/nacos · error · IllegalArgumentException
Skill is required
Error message
Skill is required
What it means
Thrown by SkillOptimizationForm.validate() (copilot module) when the `skill` field is null. This form backs the POST /v3/console/copilot/skill/optimize SSE endpoint. The entire Skill object must be present (not just non-null) because the optimizer needs the full skill structure including its name to operate.
Source
Thrown at copilot/src/main/java/com/alibaba/nacos/copilot/form/SkillOptimizationForm.java:66
/**
* Conversation history (optional).
* Contains user inputs, tool calls, and model responses.
*/
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;
}
View on GitHub (pinned to 9b989acdf1)
Solutions
- Include a non-null `skill` object in the request body.
- Ensure the skill is loaded/selected in the UI before enabling optimize.
- Serialize the full Skill model (with at least a name) before posting.
Example fix
// before
body: JSON.stringify({ skill: currentSkill, optimizationGoal })
// after
if (!currentSkill) {
setError('Select or load a skill to optimize');
return;
}
body: JSON.stringify({ skill: currentSkill, optimizationGoal }) Defensive patterns
Strategy: validation
Validate before calling
function hasSkill(skill: unknown): boolean {
return skill !== null && skill !== undefined && typeof skill === 'object';
} Type guard
function isSkillLike(value: unknown): value is { name: string } {
return value !== null && typeof value === 'object' && 'name' in value;
} Prevention
- Include a non-null skill object in the optimize request body.
- Load/select a skill in the UI before enabling optimize.
- Serialize the full Skill model before posting.
When it happens
Trigger: Posting to /v3/console/copilot/skill/optimize with the `skill` field omitted or explicitly null in the JSON body. optimizationGoal, selectedMcpTools, conversationHistory, and targetFileName are all optional.
Common situations: Client serializes a null skill reference. Form submitted before a skill is selected/loaded. API caller omits the skill object.
Related errors
- Skill name is required
- Prompt is required
- User input is required
- Prompt is required
- Background information is required
AI-assisted analysis of alibaba/nacos@9b989acdf1 (2026-08-14).
Data as JSON: /api/errors/67a12d96f12631e7.
Report an issue: GitHub.