{"record":{"id":"e01fdd8ba8601c32","repo":"gastownhall/beads","slug":"loading-aspect-q-w","errorCode":null,"errorMessage":"loading aspect %q: %w","messagePattern":"loading aspect %q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/cook.go","lineNumber":206,"sourceCode":"\t\treturn nil, fmt.Errorf(\"applying inline expansions: %w\", err)\n\t}\n\tresolved.Steps = inlineExpandedSteps\n\n\t// Apply expansion operators\n\tif resolved.Compose != nil && (len(resolved.Compose.Expand) > 0 || len(resolved.Compose.Map) > 0) {\n\t\texpandedSteps, err := formula.ApplyExpansions(resolved.Steps, resolved.Compose, parser)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"applying expansions: %w\", err)\n\t\t}\n\t\tresolved.Steps = expandedSteps\n\t}\n\n\t// Apply aspects from compose.aspects\n\tif resolved.Compose != nil && len(resolved.Compose.Aspects) > 0 {\n\t\tfor _, aspectName := range resolved.Compose.Aspects {\n\t\t\taspectFormula, err := parser.LoadByName(aspectName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"loading aspect %q: %w\", aspectName, err)\n\t\t\t}\n\t\t\tif aspectFormula.Type != formula.TypeAspect {\n\t\t\t\treturn nil, fmt.Errorf(\"%q is not an aspect formula (type=%s)\", aspectName, aspectFormula.Type)\n\t\t\t}\n\t\t\tif len(aspectFormula.Advice) > 0 {\n\t\t\t\tresolved.Steps = formula.ApplyAdvice(resolved.Steps, aspectFormula.Advice)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resolved, nil\n}\n\n// outputCookDryRun displays a dry-run preview of what would be cooked\nfunc outputCookDryRun(resolved *formula.Formula, protoID string, runtimeMode bool, inputVars map[string]string, vars, bondPoints []string) {\n\tmodeLabel := \"compile-time\"\n\tif runtimeMode {\n\t\tmodeLabel = \"runtime\"","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/cook.go#L188-L224","documentation":"`bd cook` wraps any failure from loading an aspect formula referenced in `compose.aspects`. The formula parser (`parser.LoadByName`) searches the configured search paths and fails (file not found, parse error, or I/O error); cook re-raises it with the aspect name for context. Aspects must load successfully before their advice can be applied to the resolved steps.","triggerScenarios":"Running `bd cook` on a formula whose `compose.aspects` list names an aspect that `parser.LoadByName` cannot load: aspect file missing from search paths, typo in aspect name, missing `.formula` extension resolution, or unreadable/corrupt aspect file.","commonSituations":"Hand-written formula YAML referencing an aspect that was never created; copying a formula between repos where aspect search paths differ; renaming an aspect file without updating `compose.aspects`; permission or symlink issues in the formula search directories.","solutions":["Check the aspect name in the formula's `compose.aspects` against the actual aspect file name (typos are the top cause)","Run `bd formula list` (or inspect the formula search paths) to confirm the aspect file exists in one of the search directories","Create the missing aspect formula file, or remove the aspect from `compose.aspects` if it is no longer needed","If the aspect file exists but fails to parse, fix the YAML/front-matter syntax error reported by the wrapped error"],"exampleFix":"// before (compose.aspects in formula)\naspects: [asapect-review]\n// after\naspects: [aspect-review]","handlingStrategy":"validation","validationCode":"for _, a := range formulaComposeAspects {\n    if _, err := os.Stat(filepath.Join(formulaDir, a+\".formula.yml\")); err != nil {\n        return fmt.Errorf(\"aspect %q not found in %s\", a, formulaDir)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    var nf *os.PathError\n    if errors.As(err, &nf) { /* aspect file missing: fix name or path */ }\n    return fmt.Errorf(\"loading aspect %q: %w\", aspectName, err)\n}","preventionTips":["Keep all aspect formulas in one committed formula directory covered by the search path","Reference aspects by exact file name; add a CI check that every compose.aspects entry resolves to a file","When renaming an aspect, grep the repo for the old name in compose.aspects"],"tags":["formula","aspects","file-not-found"],"backgroundTag":"formula-file-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}