siyuan-note/siyuan · error
skill resource not found
Error message
skill resource not found: %s/%s
What it means
readSkillResource resolves a resource path inside a skill directory and reads it. Before reading, it evaluates symlinks with filepath.EvalSymlinks on the joined target path; if the path cannot be resolved (missing file, broken symlink, or I/O error), it reports the resource as not found, qualified by skill name and resource path.
Solutions
- Verify the resource file exists under the skill directory (workspace/data/skills/<skillName>/<resource>) and fix the path
- Check for broken symlinks inside the skill directory and remove or repair them (ls -l, readlink)
- Confirm the kernel process has read/execute permission on every path component
- Reinstall or re-save the skill to recreate missing resources
Example fix
// before
content, err := LoadSkill("my-skill", "reference/nonexistent.md")
// after
if _, err := os.Stat(filepath.Join(util.SkillsDir(), "my-skill", "reference", "nonexistent.md")); err != nil {
return nil // resource absent; skip or use a fallback resource
}
content, err := LoadSkill("my-skill", "reference/nonexistent.md") Defensive patterns
Strategy: try-catch
Validate before calling
p := filepath.Join(util.SkillsDir(), skillName, filepath.FromSlash(resource))
if _, err := os.Stat(p); err != nil { /* resource missing — handle before calling */ } Try / catch
content, err := LoadSkill(skill, resource)
if err != nil && strings.HasPrefix(err.Error(), "skill resource not found") {
// fall back to skill description or skip the resource
} Prevention
- Stat the resource path before loading
- Keep skill resources committed/installed together with the skill definition
- Avoid symlinks inside skill directories
- Check file name casing on case-sensitive filesystems
When it happens
Trigger: LoadSkill (via readSkillResource) is called with a resource path whose joined path under the skill root does not exist on disk, points through a broken symlink, or where EvalSymlinks fails due to a permission or loop error.
Common situations: Requesting a skill resource file that was never created, a resource deleted after the skill was installed, a symlink pointing to a removed target, or a resource path with wrong casing on a case-sensitive filesystem.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- skill resource is not a regular file
- skill resource read failed
- 345
- access to sensitive workspace file is forbidden
- accessing assets in encrypted notebook
AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19).
Data as JSON: /api/errors/10c7784814a5d531.
Report an issue: GitHub.
Appendix: source
Thrown at kernel/util/skill.go:364
return nil
})
if err != nil {
truncated = true
}
sort.Strings(resources)
return resources, truncated
}
func readSkillResource(skillDir, skillName, resource string) (string, error) {
realRoot, err := filepath.EvalSymlinks(skillDir)
if err != nil {
return "", fmt.Errorf("skill not found: %s", skillName)
}
target := filepath.Join(realRoot, filepath.FromSlash(resource))
realTarget, err := filepath.EvalSymlinks(target)
if err != nil {
return "", fmt.Errorf("skill resource not found: %s/%s", skillName, resource)
}
if realTarget != realRoot && !gulu.File.IsSubPath(realRoot, realTarget) {
return "", fmt.Errorf("skill resource escapes skill directory: %s", resource)
}
info, err := os.Stat(realTarget)
if err != nil || !info.Mode().IsRegular() {
return "", fmt.Errorf("skill resource is not a regular file: %s/%s", skillName, resource)
}
if info.Size() > maxSkillResourceBytes {
return "", fmt.Errorf("skill resource exceeds the %d byte limit: %s/%s", maxSkillResourceBytes, skillName, resource)
}
file, err := os.Open(realTarget)
if err != nil {
return "", fmt.Errorf("skill resource not found: %s/%s", skillName, resource)
}
defer file.Close()View on GitHub (pinned to 9f775e8a12)