{"record":{"id":"cb5b7fabe3125eb5","repo":"gastownhall/beads","slug":"inline-expand-on-step-q-q-has-no-template-steps","errorCode":null,"errorMessage":"inline expand on step %q: %q has no template steps","messagePattern":"inline expand on step %q: %q has no template steps","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/formula/expand.go","lineNumber":481,"sourceCode":"\n\tvar result []*Step\n\n\tfor _, step := range steps {\n\t\t// Check if this step has an inline expansion\n\t\tif step.Expand != \"\" {\n\t\t\t// Load the expansion formula\n\t\t\texpFormula, err := parser.LoadByName(step.Expand)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"inline expand on step %q: loading %q: %w\", step.ID, step.Expand, err)\n\t\t\t}\n\n\t\t\tif expFormula.Type != TypeExpansion {\n\t\t\t\treturn nil, fmt.Errorf(\"inline expand on step %q: %q is not an expansion formula (type=%s)\",\n\t\t\t\t\tstep.ID, step.Expand, expFormula.Type)\n\t\t\t}\n\n\t\t\tif len(expFormula.Template) == 0 {\n\t\t\t\treturn nil, fmt.Errorf(\"inline expand on step %q: %q has no template steps\", step.ID, step.Expand)\n\t\t\t}\n\n\t\t\t// Merge formula default vars with step's ExpandVars overrides\n\t\t\tvars := mergeVars(expFormula, step.ExpandVars)\n\n\t\t\t// Expand the step using the template (reuse existing expandStep)\n\t\t\texpandedSteps, err := expandStep(step, expFormula.Template, 0, vars)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"inline expand on step %q: %w\", step.ID, err)\n\t\t\t}\n\n\t\t\t// Propagate the original step's dependencies to root steps of the expansion\n\t\t\tpropagateTargetDeps(step, expandedSteps)\n\n\t\t\t// Recursively process expanded steps for nested inline expansions\n\t\t\tprocessedSteps, err := applyInlineExpansionsRecursive(expandedSteps, parser, depth+1)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/formula/expand.go#L463-L499","documentation":"Thrown when the formula referenced by a step's Expand field is correctly typed as an expansion but contains no template steps (its Template slice is empty). An expansion formula is useless without a template to instantiate, so the library rejects it rather than silently producing zero steps.","triggerScenarios":"ApplyInlineExpansions loads an expansion formula whose file defines type=\"expansion\" but has no [[template]] entries (empty template array), then attempts to expand a step with it.","commonSituations":"Author created the expansion formula skeleton but never filled in template steps; a template section was accidentally deleted or commented out; a TOML/JSON key typo (e.g. [template] single table instead of [[template]] array) yields an empty slice.","solutions":["Add at least one [[template]] step to the referenced expansion formula.","Check for TOML syntax mistakes: [[template]] (array of tables) is required — a single [template] table may not populate the Template slice.","Point the Expand field at a different, complete expansion formula."],"exampleFix":"// before (expansion with no template)\nformula = \"scaffolding\"\ntype = \"expansion\"\n// after\nformula = \"scaffolding\"\ntype = \"expansion\"\n[[template]]\nid = \"create-files\"\ntitle = \"Create {target.title} files\"","handlingStrategy":"validation","validationCode":"f, err := parser.LoadByName(step.Expand)\nif err != nil {\n\treturn err\n}\nif f.Type == formula.TypeExpansion && len(f.Template) == 0 {\n\treturn fmt.Errorf(\"expansion %q declares no [[template]] steps\", step.Expand)\n}","typeGuard":"func hasTemplate(f *formula.Formula) bool {\n\treturn f != nil && f.Type == formula.TypeExpansion && len(f.Template) > 0\n}","tryCatchPattern":null,"preventionTips":["Never leave an expansion formula with an empty template; delete or fill it.","Use [[template]] (array of tables) in TOML, not a single [template] table.","Add a CI validation that rejects expansion formulas with zero template steps."],"tags":["go","formula","config","template"],"backgroundTag":"empty-expansion-template","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}