{"record":{"id":"10c7784814a5d531","repo":"siyuan-note/siyuan","slug":"skill-resource-not-found-s-s","errorCode":null,"errorMessage":"skill resource not found: %s/%s","messagePattern":"skill resource not found: (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/util/skill.go","lineNumber":364,"sourceCode":"\t\treturn nil\n\t})\n\tif err != nil {\n\t\ttruncated = true\n\t}\n\tsort.Strings(resources)\n\treturn resources, truncated\n}\n\nfunc readSkillResource(skillDir, skillName, resource string) (string, error) {\n\trealRoot, err := filepath.EvalSymlinks(skillDir)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"skill not found: %s\", skillName)\n\t}\n\n\ttarget := filepath.Join(realRoot, filepath.FromSlash(resource))\n\trealTarget, err := filepath.EvalSymlinks(target)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"skill resource not found: %s/%s\", skillName, resource)\n\t}\n\tif realTarget != realRoot && !gulu.File.IsSubPath(realRoot, realTarget) {\n\t\treturn \"\", fmt.Errorf(\"skill resource escapes skill directory: %s\", resource)\n\t}\n\n\tinfo, err := os.Stat(realTarget)\n\tif err != nil || !info.Mode().IsRegular() {\n\t\treturn \"\", fmt.Errorf(\"skill resource is not a regular file: %s/%s\", skillName, resource)\n\t}\n\tif info.Size() > maxSkillResourceBytes {\n\t\treturn \"\", fmt.Errorf(\"skill resource exceeds the %d byte limit: %s/%s\", maxSkillResourceBytes, skillName, resource)\n\t}\n\n\tfile, err := os.Open(realTarget)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"skill resource not found: %s/%s\", skillName, resource)\n\t}\n\tdefer file.Close()","sourceCodeStart":346,"sourceCodeEnd":382,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/util/skill.go#L346-L382","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\ncontent, err := LoadSkill(\"my-skill\", \"reference/nonexistent.md\")\n// after\nif _, err := os.Stat(filepath.Join(util.SkillsDir(), \"my-skill\", \"reference\", \"nonexistent.md\")); err != nil {\n    return nil // resource absent; skip or use a fallback resource\n}\ncontent, err := LoadSkill(\"my-skill\", \"reference/nonexistent.md\")","handlingStrategy":"try-catch","validationCode":"p := filepath.Join(util.SkillsDir(), skillName, filepath.FromSlash(resource))\nif _, err := os.Stat(p); err != nil { /* resource missing — handle before calling */ }","typeGuard":null,"tryCatchPattern":"content, err := LoadSkill(skill, resource)\nif err != nil && strings.HasPrefix(err.Error(), \"skill resource not found\") {\n    // fall back to skill description or skip the resource\n}","preventionTips":["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"],"tags":["skill","filesystem","resource-not-found"],"backgroundTag":"file-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}