{"record":{"id":"0db09be86df025d9","repo":"larksuite/cli","slug":"official-skills-index-exceeds-d-bytes","errorCode":null,"errorMessage":"official skills index exceeds %d bytes","messagePattern":"official skills index exceeds (.+?) bytes","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/selfupdate/updater.go","lineNumber":322,"sourceCode":"\tif err != nil {\n\t\tr.Err = err\n\t\treturn r\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {\n\t\tr.Err = fmt.Errorf(\"official skills index returned HTTP %d\", resp.StatusCode)\n\t\treturn r\n\t}\n\n\tlimited := io.LimitReader(resp.Body, skillsIndexMaxBodySize+1)\n\tif _, err := io.Copy(&r.Stdout, limited); err != nil {\n\t\tr.Err = err\n\t\treturn r\n\t}\n\tif r.Stdout.Len() > skillsIndexMaxBodySize {\n\t\tr.Stdout.Reset()\n\t\tr.Err = fmt.Errorf(\"official skills index exceeds %d bytes\", skillsIndexMaxBodySize)\n\t\treturn r\n\t}\n\treturn r\n}\n\nfunc (u *Updater) ListGlobalSkills() *NpmResult {\n\treturn u.runSkillsListGlobal()\n}\n\nfunc (u *Updater) ListGlobalSkillsJSON() *NpmResult {\n\treturn u.runSkillsCommand(\"-y\", \"skills\", \"ls\", \"-g\", \"--json\")\n}\n\nfunc (u *Updater) InstallSkills(source string, nameList []string) *NpmResult {\n\treturn u.runSkillsInstall(source, nameList)\n}\n\nfunc (u *Updater) InstallAllSkills(source string) *NpmResult {","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/selfupdate/updater.go#L304-L340","documentation":"FetchSkillsIndex reads the response body through an io.LimitReader capped at skillsIndexMaxBodySize. If the body is larger than the cap, the buffered output is discarded and this error is returned, protecting the CLI from unexpectedly huge or hostile index payloads.","triggerScenarios":"Calling Updater.FetchSkillsIndex(source) when the HTTP response body exceeds skillsIndexMaxBodySize bytes — r.Stdout.Len() > skillsIndexMaxBodySize after the copy.","commonSituations":"Pointing the skills source at the wrong URL (e.g. a tarball or full package download instead of the JSON index); a mirror returning an HTML error page or directory listing; a corrupted/misbehaving proxy dumping large content.","solutions":["Verify the source URL points at the actual skills index JSON, not a package tarball or HTML page","Inspect what the endpoint returns (curl the URL) to see why the payload is oversized","Fix a misbehaving mirror/proxy returning bloated or wrong content and retry","If the official index legitimately grew past the cap, update the CLI to a version with a raised limit"],"exampleFix":"// before\nsource := \"https://registry.example.com/@larksuite/cli/-/cli-1.2.3.tgz\" // wrong: tarball, not index\nres := updater.FetchSkillsIndex(source)\n// after\nsource := \"https://registry.example.com/skills/index.json\" // the real index document\nres := updater.FetchSkillsIndex(source)","handlingStrategy":"validation","validationCode":"resp, err := http.Get(indexURL)\nif err == nil { b, _ := io.ReadAll(io.LimitReader(resp.Body, 1<<20)); if len(b) > skillsIndexMaxBodySize { /* URL is wrong or endpoint bloated */ } }","typeGuard":null,"tryCatchPattern":"res := updater.FetchSkillsIndex(source)\nif res.Err != nil {\n\tif strings.Contains(res.Err.Error(), \"exceeds\") && strings.Contains(res.Err.Error(), \"bytes\") {\n\t\t// wrong URL or hostile payload: verify source points at index JSON\n\t} else {\n\t\treturn res.Err\n\t}\n}","preventionTips":["Point the source at the index JSON document, never a tarball or HTML page","curl the endpoint once to sanity-check content type and size","Use trusted mirrors that return well-formed small index documents","Keep the CLI updated so the size cap tracks the real index growth"],"tags":["http","limit","payload-size","selfupdate","validation"],"backgroundTag":"response-payload-too-large","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}