{"record":{"id":"ed6bbef9a50f9f18","repo":"gastownhall/beads","slug":"q-is-not-an-aspect-formula-type-s","errorCode":null,"errorMessage":"%q is not an aspect formula (type=%s)","messagePattern":"%q is not an aspect formula \\(type=(.+?)\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/cook.go","lineNumber":209,"sourceCode":"\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\"\n\t\t// Apply defaults for runtime mode display\n\t\tfor name, def := range resolved.Vars {\n\t\t\tif _, provided := inputVars[name]; !provided && def.Default != nil {","sourceCodeStart":191,"sourceCodeEnd":227,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/cook.go#L191-L227","documentation":"`bd cook` validates that every formula named in `compose.aspects` actually has `type: aspect`. If the loaded formula's `Type` differs from `formula.TypeAspect`, cook refuses to apply its advice and reports the actual type. This guards against composing with a step-procedure or other non-aspect formula whose advice semantics don't apply.","triggerScenarios":"`compose.aspects` references a formula whose front-matter declares a different type (e.g. `type: procedure`, `type: pipeline`). Loading succeeds, but the type check at cook.go:209 fails.","commonSituations":"Authoring a new formula and forgetting `type: aspect` in its front matter; pointing `compose.aspects` at a main formula by mistake; copying an aspect but leaving the parent's type value; old formulas written before the type field existed.","solutions":["Open the aspect formula file and set `type: aspect` in its front matter","If the referenced formula is not meant to be an aspect, remove it from `compose.aspects` and reference the correct aspect name","Run `bd formula validate <name>` (or equivalent) to confirm the type is recognized after editing"],"exampleFix":"// before (aspect formula front matter)\ntype: procedure\n// after\ntype: aspect","handlingStrategy":"validation","validationCode":"f, err := parser.LoadByName(name)\nif err != nil { return err }\nif f.Type != formula.TypeAspect {\n    return fmt.Errorf(\"%q has type %s, need aspect\", name, f.Type)\n}","typeGuard":"func isAspect(f *formula.Formula) bool { return f != nil && f.Type == formula.TypeAspect }","tryCatchPattern":null,"preventionTips":["Always set `type: aspect` when creating an aspect formula from a template","Validate formulas (bd formula validate) before referencing them in compose.aspects","Don't point compose.aspects at main/pipeline formulas"],"tags":["formula","aspects","type-mismatch","validation"],"backgroundTag":"formula-wrong-type","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}