{"record":{"id":"48ac827d09d1ebe7","repo":"siyuan-note/siyuan","slug":"skill-resource-exceeds-the-d-byte-limit-s-s","errorCode":null,"errorMessage":"skill resource exceeds the %d byte limit: %s/%s","messagePattern":"skill resource exceeds the (.+?) byte limit: (.+?)/(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/util/skill.go","lineNumber":375,"sourceCode":"\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()\n\tdata, err := io.ReadAll(io.LimitReader(file, maxSkillResourceBytes+1))\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"skill resource read failed: %s/%s\", skillName, resource)\n\t}\n\tif len(data) > maxSkillResourceBytes {\n\t\treturn \"\", fmt.Errorf(\"skill resource exceeds the %d byte limit: %s/%s\", maxSkillResourceBytes, skillName, resource)\n\t}\n\tif !utf8.Valid(data) {\n\t\treturn \"\", fmt.Errorf(\"skill resource is not valid UTF-8: %s/%s\", skillName, resource)\n\t}\n\treturn string(data), nil","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/util/skill.go#L357-L393","documentation":"readSkillResource enforces a maximum resource size (maxSkillResourceBytes). If the stat size of the resolved resource exceeds the limit, it refuses to read the file and reports the limit plus the skill and resource names.","triggerScenarios":"LoadSkill is called for a resource whose on-disk size is larger than maxSkillResourceBytes (checked via os.Stat before opening).","commonSituations":"Dropping a large dump/log/dataset file into a skill directory and referencing it as a resource; a skill whose reference document grew past the size cap over successive edits.","solutions":["Shrink the resource file (split it into multiple smaller resource files under the size limit)","Move the large data out of the skill directory and reference only summaries or extracts","Compress or truncate the content and keep only what the skill needs at load time"],"exampleFix":"// before\nskills/my-skill/reference/full-dump.md  // 50 MB, exceeds limit\n// after\nskills/my-skill/reference/index.md      // small curated summary\nskills/my-skill/reference/part-1.md     // split chunks below the limit","handlingStrategy":"validation","validationCode":"fi, err := os.Stat(p)\nif err == nil && fi.Size() > maxResourceLimit { /* too large — split or summarize first */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check file size before adding it as a skill resource","Keep reference documents small and split large content into chunks","Move bulk data out of skill directories"],"tags":["skill","size-limit","resource"],"backgroundTag":"file-size-limit-exceeded","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"}