gastownhall/beads · error

formula %q not accessible: %w

Error message

formula %q not accessible: %w

What it means

verifyFormula confirms that a named formula exists and its variables validate before mol seed proceeds. If the lookup fails for any reason other than ErrVarValidation, it is wrapped as 'formula %q not accessible: %w' — the formula itself cannot be loaded (missing, unreadable, or a lower-level access error), as distinct from bad --var values.

Source

Thrown at cmd/bd/mol_seed.go:87

	return nil
}

// verifyFormula checks if a formula can be loaded and cooked
func verifyFormula(formulaName string, vars map[string]string) error {
	// Try to cook the formula - this verifies:
	// 1. Formula exists in search path
	// 2. Formula syntax is valid
	// 3. Formula can be resolved (extends, etc.)
	// 4. Formula can be cooked to subgraph
	_, err := resolveAndCookFormulaWithVars(formulaName, nil, vars)
	if err != nil {
		if errors.Is(err, formula.ErrVarValidation) {
			// Don't double-wrap: the --var values fail enum/pattern/
			// required-empty constraints, which is a distinct condition
			// from the formula itself being inaccessible.
			return err
		}
		return fmt.Errorf("formula %q not accessible: %w", formulaName, err)
	}
	return nil
}

func init() {
	molSeedCmd.Flags().StringArray("var", []string{}, "Variable substitution for condition filtering (key=value)")
	molCmd.AddCommand(molSeedCmd)
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Run bd formula list (or the equivalent) to see available formula names and correct the spelling
  2. Check that the formula exists in this repo/version; upgrade bd if the formula is newer
  3. If loading from a file/path, verify the file exists and is readable
  4. If the wrapped cause indicates permissions, fix file permissions or reinstall formulas

Example fix

// before: guessing at the name
bd mol seed --formula auth-flw
// after: verify first
bd formula list | grep auth
bd mol seed --formula auth-flow --var env=prod
Defensive patterns

Strategy: validation

Validate before calling

// Verify the formula exists before mol seed
if !formulaExists(name) {
    return fmt.Errorf("unknown formula %q; run bd formula list", name)
}

Type guard

func formulaAccessible(name string) bool {
    _, err := formula.Lookup(name)
    return err == nil
}

Try / catch

if err := verifyFormula(ctx, formulaName); err != nil {
    if errors.Is(err, formula.ErrVarValidation) {
        // bad --var values: fix the variables
    } else {
        // formula not accessible: fix the name/install
    }
    return err
}

Prevention

When it happens

Trigger: bd mol seed --formula <name> where the formula name does not exist, the formula file/registry entry cannot be read, or the embedded formula table lacks the name. Explicitly NOT raised for invalid --var values (those pass through unwrapped).

Common situations: Typo in the formula name; running in a repo/directory where the formula is not installed; older bd version that predates the formula; formula deleted or renamed upstream.

Related errors


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