larksuite/cli · error

invalid skill name %q

Error message

invalid skill name %q

What it means

ParseOfficialSkillsIndexJSON rejects an index entry whose name (after trimming) does not match skillNamePattern. This enforces a strict naming convention for skills fetched from the official index so downstream filesystem paths and references stay safe.

Source

Thrown at internal/skillscheck/sync.go:114

		Name   string `json:"name"`
		Type   string `json:"type"`
		URL    string `json:"url"`
		Digest string `json:"digest"`
	}
	type officialIndex struct {
		Skills []officialSkill `json:"skills"`
	}

	var index officialIndex
	if err := json.Unmarshal([]byte(text), &index); err != nil {
		return nil, err
	}

	seen := map[string]bool{}
	for _, skill := range index.Skills {
		candidate := strings.TrimSpace(skill.Name)
		if !skillNamePattern.MatchString(candidate) {
			return nil, fmt.Errorf("invalid skill name %q", candidate)
		}
		if skill.Type != "archive" || strings.TrimSpace(skill.URL) == "" || !digestPattern.MatchString(skill.Digest) {
			return nil, fmt.Errorf("skill %s is not a complete v0.2 archive entry", candidate)
		}
		if seen[candidate] {
			return nil, fmt.Errorf("duplicate skill %s", candidate)
		}
		seen[candidate] = true
	}

	return sortedKeys(seen), nil
}

// parseGlobalSkillsList parses the output of "npx -y skills ls -g"
func parseGlobalSkillsList(lines []string) []string {
	seen := map[string]bool{}

	for _, line := range lines {

View on GitHub (pinned to 7fd6ef3c07)

Solutions

  1. Fix the `name` field in the index entry to conform to the skillNamePattern (typically lowercase-kebab identifiers)
  2. Check whether the upstream index schema changed and update the parser or pin to a supported index version
  3. If serving a custom index, validate all skill names against the pattern before publishing
  4. Inspect the raw index JSON to identify the offending entry at the reported name

Example fix

// before
{"name": "My Skill/Backup", "type": "archive", ...}
// after
{"name": "my-skill-backup", "type": "archive", ...}
Defensive patterns

Strategy: validation

Validate before calling

var idx struct{ Skills []struct{ Name string `json:"name"` } `json:"skills"` }
if err := json.Unmarshal(indexData, &idx); err == nil {
    for _, s := range idx.Skills {
        name := strings.TrimSpace(s.Name)
        if name == "" || strings.ContainsAny(name, " /\\") || strings.ToLower(name) != name {
            // reject or fix before calling fetchOfficialSkills
        }
    }
}

Try / catch

skills, err := skillscheck.ParseOfficialSkillsIndexJSON(data)
if err != nil {
    if strings.Contains(err.Error(), "invalid skill name") {
        // fetch and log the raw index for inspection, then retry with corrected index
    }
    return err
}

Prevention

When it happens

Trigger: fetchOfficialSkills parsing an official skills index JSON where an entry's `name` field contains characters outside the allowed pattern (spaces, slashes, uppercase/odd punctuation) or is empty after trimming.

Common situations: A typo or format change in the upstream index file; a mirror or proxy serving a modified/older index; hand-crafted test or custom index files that don't follow the v0.2 naming rules.

Related errors


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