gastownhall/beads · error

extends %s: %w

Error message

extends %s: %w

What it means

Resolve() failed to load one of the formula's parents via loadFormula(parentName) while walking the Extends list, and wraps that underlying error (e.g. 'not found in search paths' or a parse error) as 'extends <parent>: <cause>'. It identifies which parent entry in the extends list is broken.

Source

Thrown at internal/formula/parser.go:238

	}

	// Build merged formula from parents
	merged := &Formula{
		Formula:     formula.Formula,
		Description: formula.Description,
		Version:     formula.Version,
		Type:        formula.Type,
		Source:      formula.Source,
		Vars:        make(map[string]*VarDef),
		Steps:       nil,
		Compose:     nil,
	}

	// Apply each parent in order
	for _, parentName := range formula.Extends {
		parent, err := p.loadFormula(parentName)
		if err != nil {
			return nil, fmt.Errorf("extends %s: %w", parentName, err)
		}

		// Resolve parent recursively
		parent, err = p.Resolve(parent)
		if err != nil {
			return nil, fmt.Errorf("resolve parent %s: %w", parentName, err)
		}

		// Merge parent vars (parent vars are inherited, child overrides)
		for name, varDef := range parent.Vars {
			if _, exists := merged.Vars[name]; !exists {
				merged.Vars[name] = varDef
			}
		}

		// Merge parent steps (append, child steps come after)
		merged.Steps = append(merged.Steps, parent.Steps...)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the parent name in the error against the actual formula filenames in your search-path directories; fix typos.
  2. Add the directory holding the parent formula to the parser's search paths.
  3. Restore or fix the parent formula file (the wrapped cause tells you whether it is missing or unparseable).

Example fix

# before: build.md
extends: [deplo]  # typo

# after: build.md
extends: [deploy]
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check every extends entry resolves before Resolve.
for _, parent := range f.Extends {
	if _, err := p.LoadByName(parent); err != nil {
		return fmt.Errorf"bad extends entry %q: %w", parent, err
	}
}

Try / catch

if _, err := p.Resolve(f); err != nil {
	var cause error
	errors.As(err, &cause) // unwrap chain; log full chain
}

Prevention

When it happens

Trigger: Calling Resolve or LoadByName on a formula whose 'extends:' names a parent that does not exist in any search path, or whose parent file fails to parse/load (loadFormula returned a non-nil error).

Common situations: Typo in the parent name inside extends; parent formula file deleted or renamed; search paths (searchPath option) not including the directory containing the parent; parent file has YAML syntax errors so parsing fails.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/54236837469e381b. Report an issue: GitHub.