{"record":{"id":"2fb98d2a07b0cdcd","repo":"larksuite/cli","slug":"verify-cropped-suite-w","errorCode":null,"errorMessage":"verify cropped suite: %w","messagePattern":"verify cropped suite: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/skillscheck/layout.go","lineNumber":121,"sourceCode":"\t\tremoved = append(removed, name)\n\t}\n\n\tskillPath := filepath.Join(suitePath, \"SKILL.md\")\n\traw, err := vfs.ReadFile(skillPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read suite SKILL.md: %w\", err)\n\t}\n\trendered, err := cropSuiteRoutes(string(raw), removed, target)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := vfs.WriteFile(skillPath, []byte(rendered), 0o644); err != nil {\n\t\treturn fmt.Errorf(\"write cropped suite SKILL.md: %w\", err)\n\t}\n\n\tkept, err := listDirectSubdirs(referencesPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"verify cropped suite: %w\", err)\n\t}\n\treturn assertSameSkillNames(kept, target, \"cropped suite\")\n}\n\nfunc cropSuiteRoutes(content string, removed, target []string) (string, error) {\n\trouteLine := func(name string) *regexp.Regexp {\n\t\treturn regexp.MustCompile(`(?m)^- ` + regexp.QuoteMeta(name) + `(?:（[^）\\n]*）)?:[^\\n]*(?:\\n|$)`)\n\t}\n\n\tfor _, name := range removed {\n\t\tline := routeLine(name)\n\t\tif len(line.FindAllStringIndex(content, -1)) != 1 {\n\t\t\treturn \"\", fmt.Errorf(\"suite route for %s is missing or duplicated\", name)\n\t\t}\n\t\tcontent = line.ReplaceAllString(content, \"\")\n\t}\n\n\tfor _, name := range target {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/skillscheck/layout.go#L103-L139","documentation":"Wraps a failure when re-listing the cropped suite's references subdirectories to verify the post-crop layout matches the target skill set.","triggerScenarios":"Thrown at internal/skillscheck/layout.go:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-stage the suite archive and retry the sync"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}