{"record":{"id":"7ad1068e3a2ac061","repo":"gastownhall/beads","slug":"missing-required-variables-s","errorCode":null,"errorMessage":"missing required variables: %s","messagePattern":"missing required variables: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/pour.go","lineNumber":261,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\trequiredVars = append(requiredVars, v)\n\t\t\t}\n\t\t}\n\t}\n\treturn requiredVars\n}\n\nfunc checkPourVars(subgraph *TemplateSubgraph, attachSubgraphs []*TemplateSubgraph, vars map[string]string) error {\n\tvar missingVars []string\n\tfor _, v := range requiredVarsAcross(subgraph, attachSubgraphs) {\n\t\tif _, ok := vars[v]; !ok {\n\t\t\tmissingVars = append(missingVars, v)\n\t\t}\n\t}\n\tif len(missingVars) > 0 {\n\t\treturn fmt.Errorf(\"missing required variables: %s\", strings.Join(missingVars, \", \"))\n\t}\n\treturn nil\n}\n\nfunc missingVarHint(subgraph *TemplateSubgraph, attachSubgraphs []*TemplateSubgraph, vars map[string]string) string {\n\tfor _, v := range requiredVarsAcross(subgraph, attachSubgraphs) {\n\t\tif _, ok := vars[v]; !ok {\n\t\t\treturn v\n\t\t}\n\t}\n\treturn \"\"\n}\n\ntype pourAttachPreview struct {\n\ttitle string\n\tsteps int\n}\n","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/pour.go#L243-L279","documentation":"`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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the missing names from the error and re-run with -v name=value (or --var) for each one","Inspect the molecule template to see which variables it and its attach subgraphs require (the missingVarHint helper iterates the same requiredVarsAcross set)","If the template wrongly marks a variable required, fix the subgraph definition or give it a default","Check for typos between your --var keys and the template's variable names"],"exampleFix":"// before\nbd pour my-molecule\n// after\nbd pour my-molecule -v target=prod -v region=us-east-1","handlingStrategy":"validation","validationCode":"// shell: verify all required vars before pouring\nfor v in $(grep -o '{{[[:space:]]*\\.Vars\\.[A-Za-z0-9_]*' molecule.tmpl | grep -o '[A-Za-z0-9_]*$' | sort -u); do\n  [ -n \"${!v:-}\" ] || echo \"missing var: $v\"\ndone","typeGuard":null,"tryCatchPattern":"// Go caller of runPour-equivalent\nif err := checkPourVars(subgraph, attachSubs, vars); err != nil {\n    var missing []string\n    if strings.HasPrefix(err.Error(), \"missing required variables: \") {\n        missing = strings.Split(strings.TrimPrefix(err.Error(), \"missing required variables: \"), \", \")\n    }\n    return fmt.Errorf(\"pour aborted; supply these vars: %v\", missing)\n}","preventionTips":["List required vars with the tool's hint output (missingVarHint) before pouring","Keep -v flags in a committed script/Makefile per molecule","Diff your var set whenever the molecule template or its attach subgraphs change"],"tags":["cli","validation","templates","variables"],"backgroundTag":"missing-required-variable","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}