charmbracelet/crush · error

name is required

Error message

name is required

What it means

Skill.Validate enforces the skill spec. It emits this error when the parsed skill's Name field is empty — the frontmatter is missing a `name:` key or it is blank. All validation errors are joined and returned together.

Source

Thrown at internal/skills/skills.go:122

	defer latestStatesMu.RUnlock()
	return cloneStates(latestStates)
}

// SetLatestStates stores the given states in the package-level cache so that
// GetLatestStates can return them synchronously before the first pubsub event
// arrives.
func SetLatestStates(states []*SkillState) {
	latestStatesMu.Lock()
	latestStates = cloneStates(states)
	latestStatesMu.Unlock()
}

// Validate checks if the skill meets spec requirements.
func (s *Skill) Validate() error {
	var errs []error

	if s.Name == "" {
		errs = append(errs, errors.New("name is required"))
	} else {
		if len(s.Name) > MaxNameLength {
			errs = append(errs, fmt.Errorf("name exceeds %d characters", MaxNameLength))
		}
		if !namePattern.MatchString(s.Name) {
			errs = append(errs, errors.New("name must be alphanumeric with hyphens, no leading/trailing/consecutive hyphens"))
		}
		if s.Path != "" && !strings.EqualFold(filepath.Base(s.Path), s.Name) {
			errs = append(errs, fmt.Errorf("name %q must match directory %q", s.Name, filepath.Base(s.Path)))
		}
	}

	if s.Description == "" {
		errs = append(errs, errors.New("description is required"))
	} else if len(s.Description) > MaxDescriptionLength {
		errs = append(errs, fmt.Errorf("description exceeds %d characters", MaxDescriptionLength))
	}

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Add a `name:` field to the SKILL.md YAML frontmatter
  2. Verify the frontmatter is properly delimited by `---` lines so the name is actually parsed
  3. Re-check that the name also satisfies length and pattern rules once set

Example fix

// before (SKILL.md frontmatter)
---
description: Does things
---
// after
---
name: my-skill
description: Does things
---
Defensive patterns

Strategy: validation

Validate before calling

if skill.Name == "" {
	return errors.New("skill frontmatter must define a name")
}

Try / catch

if err := skill.Validate(); err != nil {
	return fmt.Errorf("invalid skill %s: %w", skill.Path, err)
}

Prevention

When it happens

Trigger: Parsing a SKILL.md whose YAML frontmatter lacks `name:` or has `name: ""`, then calling Validate.

Common situations: Hand-written skill files missing required frontmatter keys; frontmatter delimiters misplaced so YAML keys are parsed into the body; copying a template and forgetting to fill in the name.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/5581747af828b21e. Report an issue: GitHub.