alibaba/spring-ai-alibaba · error · IllegalArgumentException
Skill path cannot be null or empty
Error message
Skill path cannot be null or empty
What it means
AbstractSkillRegistry.readSkillContentByPath validates that the given skill path is non-null and non-blank before normalizing and looking it up, throwing IllegalArgumentException on blank input. A path is mandatory to locate the registered skill whose full content should be read.
Source
Thrown at spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/skills/registry/AbstractSkillRegistry.java:123
}
@Override
public boolean disableByPath(String skillPath) {
return findByPathInternal(skillPath)
.map(SkillMetadata::getName)
.map(this::disable)
.orElse(false);
}
@Override
public boolean isDisabled(String name) {
return name != null && disabledSkillNames.contains(name);
}
@Override
public String readSkillContentByPath(String skillPath) throws IOException {
if (skillPath == null || skillPath.isBlank()) {
throw new IllegalArgumentException("Skill path cannot be null or empty");
}
requireNormalizedSkillPath(skillPath);
SkillMetadata skill = getByPath(skillPath)
.orElseThrow(() -> new IllegalStateException("Skill not found: " + skillPath));
return skill.loadFullContent();
}
protected abstract void loadSkillsToRegistry();
protected static String normalizeSkillPath(String skillPath) {
try {
return Path.of(skillPath).toAbsolutePath().normalize().toString();
}
catch (InvalidPathException ex) {
throw new IllegalArgumentException("Invalid skill path: " + skillPath, ex);
}
}
View on GitHub (pinned to f82da0b50f)
Solutions
- Ensure callers pass a real skill path obtained from the registry (e.g. from SkillMetadata.getSkillPath())
- Guard the input: check skillPath != null && !skillPath.isBlank() before calling
- Verify the skill was registered so a valid path exists in the first place
Example fix
// before
String content = registry.readSkillContentByPath(skillPath);
// after
if (skillPath == null || skillPath.isBlank()) { throw new IllegalArgumentException("skillPath must be provided"); }
String content = registry.readSkillContentByPath(skillPath); Defensive patterns
Strategy: type-guard
Validate before calling
if (skillPath == null || skillPath.isBlank()) { throw new IllegalArgumentException("skillPath required"); } Type guard
boolean validSkillPath(String p) { return p != null && !p.isBlank(); } Try / catch
try { content = registry.readSkillContentByPath(p); } catch (IllegalArgumentException e) { log.warn("Bad skill path: {}", e.getMessage()); } Prevention
- Source paths from SkillMetadata.getSkillPath(), never from unvalidated input
- Reject empty tool-call arguments before invoking registry APIs
- Log the origin of null/blank paths to catch upstream lookup bugs
When it happens
Trigger: Calling readSkillContentByPath(null) or readSkillContentByPath("") / whitespace-only string, typically when the path originated from an unresolved lookup or empty tool argument.
Common situations: An LLM tool call supplies an empty skill_path argument; upstream code propagates a null path after a failed skill lookup; template variables left unsubstituted.
Related errors
- ${type} requires valid configuration
- Version ID cannot be null
- Configuration cannot be null
- Skill description is required
- Skill path is required
AI-assisted analysis of alibaba/spring-ai-alibaba@f82da0b50f (2026-09-09).
Data as JSON: /api/errors/77fde9f22547f52d.
Report an issue: GitHub.