larksuite/cli · error

write cropped suite SKILL.md: %w

Error message

write cropped suite SKILL.md: %w

What it means

Wraps vfs.WriteFile failure after cropping routes from the staged suite's SKILL.md; the modified content could not be persisted back to the staging tree.

Source

Thrown at internal/skillscheck/layout.go:116

			continue
		}
		if err := vfs.RemoveAll(filepath.Join(referencesPath, name)); err != nil {
			return fmt.Errorf("remove suite child %s: %w", name, err)
		}
		removed = append(removed, name)
	}

	skillPath := filepath.Join(suitePath, "SKILL.md")
	raw, err := vfs.ReadFile(skillPath)
	if err != nil {
		return fmt.Errorf("read suite SKILL.md: %w", err)
	}
	rendered, err := cropSuiteRoutes(string(raw), removed, target)
	if err != nil {
		return err
	}
	if err := vfs.WriteFile(skillPath, []byte(rendered), 0o644); err != nil {
		return fmt.Errorf("write cropped suite SKILL.md: %w", err)
	}

	kept, err := listDirectSubdirs(referencesPath)
	if err != nil {
		return fmt.Errorf("verify cropped suite: %w", err)
	}
	return assertSameSkillNames(kept, target, "cropped suite")
}

func cropSuiteRoutes(content string, removed, target []string) (string, error) {
	routeLine := func(name string) *regexp.Regexp {
		return regexp.MustCompile(`(?m)^- ` + regexp.QuoteMeta(name) + `(?:([^)\n]*))?:[^\n]*(?:\n|$)`)
	}

	for _, name := range removed {
		line := routeLine(name)
		if len(line.FindAllStringIndex(content, -1)) != 1 {
			return "", fmt.Errorf("suite route for %s is missing or duplicated", name)

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Check staging space and permissions, then retry the sync
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/skillscheck/layout.go:116 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of larksuite/cli@7fd6ef3c07 (2026-09-04). Data as JSON: /api/errors/517944ea8764dc1b. Report an issue: GitHub.