gastownhall/beads · error

missing required variables: %s

Error message

missing required variables: %s

What it means

`bd pour` renders a molecule template (subgraph) with user-supplied variables. Before rendering, checkPourVars compares the set of variables required by the template and its attached subgraphs (requiredVarsAcross) against the vars map passed on the command line. If any required variable has no value, the pour is aborted with this error listing all missing names.

Source

Thrown at cmd/bd/pour.go:261

				}
			}
			if !found {
				requiredVars = append(requiredVars, v)
			}
		}
	}
	return requiredVars
}

func checkPourVars(subgraph *TemplateSubgraph, attachSubgraphs []*TemplateSubgraph, vars map[string]string) error {
	var missingVars []string
	for _, v := range requiredVarsAcross(subgraph, attachSubgraphs) {
		if _, ok := vars[v]; !ok {
			missingVars = append(missingVars, v)
		}
	}
	if len(missingVars) > 0 {
		return fmt.Errorf("missing required variables: %s", strings.Join(missingVars, ", "))
	}
	return nil
}

func missingVarHint(subgraph *TemplateSubgraph, attachSubgraphs []*TemplateSubgraph, vars map[string]string) string {
	for _, v := range requiredVarsAcross(subgraph, attachSubgraphs) {
		if _, ok := vars[v]; !ok {
			return v
		}
	}
	return ""
}

type pourAttachPreview struct {
	title string
	steps int
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the missing names from the error and re-run with -v name=value (or --var) for each one
  2. Inspect the molecule template to see which variables it and its attach subgraphs require (the missingVarHint helper iterates the same requiredVarsAcross set)
  3. If the template wrongly marks a variable required, fix the subgraph definition or give it a default
  4. Check for typos between your --var keys and the template's variable names

Example fix

// before
bd pour my-molecule
// after
bd pour my-molecule -v target=prod -v region=us-east-1
Defensive patterns

Strategy: validation

Validate before calling

// shell: verify all required vars before pouring
for v in $(grep -o '{{[[:space:]]*\.Vars\.[A-Za-z0-9_]*' molecule.tmpl | grep -o '[A-Za-z0-9_]*$' | sort -u); do
  [ -n "${!v:-}" ] || echo "missing var: $v"
done

Try / catch

// Go caller of runPour-equivalent
if err := checkPourVars(subgraph, attachSubs, vars); err != nil {
    var missing []string
    if strings.HasPrefix(err.Error(), "missing required variables: ") {
        missing = strings.Split(strings.TrimPrefix(err.Error(), "missing required variables: "), ", ")
    }
    return fmt.Errorf("pour aborted; supply these vars: %v", missing)
}

Prevention

When it happens

Trigger: Running `bd pour <molecule>` without supplying --var/-v flags for every variable referenced by the subgraph or its attached subgraphs; misspelling a variable name so it doesn't match the required key; an attached subgraph adds a required variable the caller didn't know about.

Common situations: Pouring a shared/team molecule whose template was updated to add a new required variable; forgetting a var needed only by an attach subgraph; shell quoting eating an empty --var value so it looks absent.

Related errors


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