{"record":{"id":"1bb8bf1364f94315","repo":"gastownhall/beads","slug":"runtime-mode-requires-all-variables-to-have-values","errorCode":null,"errorMessage":"runtime mode requires all variables to have values\nMissing: %s\nProvide with: --var %s=<value>","messagePattern":"runtime mode requires all variables to have values\nMissing: (.+?)\nProvide with: --var (.+?)=<value>","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/cook.go","lineNumber":301,"sourceCode":"// outputCookEphemeral outputs the resolved formula as JSON (ephemeral mode)\nfunc outputCookEphemeral(resolved *formula.Formula, runtimeMode bool, inputVars map[string]string, vars []string) error {\n\tif runtimeMode {\n\t\t// Apply defaults from formula variable definitions\n\t\tfor name, def := range resolved.Vars {\n\t\t\tif _, provided := inputVars[name]; !provided && def.Default != nil {\n\t\t\t\tinputVars[name] = *def.Default\n\t\t\t}\n\t\t}\n\n\t\t// Check for missing required variables\n\t\tvar missingVars []string\n\t\tfor _, v := range vars {\n\t\t\tif _, ok := inputVars[v]; !ok {\n\t\t\t\tmissingVars = append(missingVars, v)\n\t\t\t}\n\t\t}\n\t\tif len(missingVars) > 0 {\n\t\t\treturn fmt.Errorf(\"runtime mode requires all variables to have values\\nMissing: %s\\nProvide with: --var %s=<value>\",\n\t\t\t\tstrings.Join(missingVars, \", \"), missingVars[0])\n\t\t}\n\n\t\t// Substitute variables in the formula\n\t\tsubstituteFormulaVars(resolved, inputVars)\n\t}\n\treturn outputJSON(resolved)\n}\n\n// persistCookFormula creates a proto bead in the database (persist mode)\nfunc persistCookFormula(ctx context.Context, resolved *formula.Formula, protoID string, force bool, vars, bondPoints []string) error {\n\t// Check if proto already exists\n\texistingProto, err := store.GetIssue(ctx, protoID)\n\tif err == nil && existingProto != nil {\n\t\tif !force {\n\t\t\treturn fmt.Errorf(\"proto %s already exists (use --force to replace)\", protoID)\n\t\t}\n\t\t// Delete existing proto and its children","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/cook.go#L283-L319","documentation":"In `--mode=runtime`, `bd cook` requires every variable declared by the formula to be supplied via `--var`. Before cooking, it diffs the formula's declared vars against the provided input vars and fails, listing all missing names and hinting the `--var <name>=<value>` syntax for the first one. Runtime mode cooks an ephemeral subgraph, so unresolved variables cannot be left symbolic.","triggerScenarios":"Running `bd cook <formula> --mode=runtime` while omitting one or more `--var` flags for variables the formula declares; providing vars with misspelled names that don't match declarations.","commonSituations":"Formula gained a new required variable after the user's script/alias was written; copy-pasting a cook command from docs without filling in vars; shell quoting dropping a `--var` argument; confusing runtime mode's all-vars-required rule with interactive mode's prompting.","solutions":["Read the `Missing:` list in the message and pass each variable: `bd cook <formula> --mode=runtime --var name1=value1 --var name2=value2`","Run `bd formula show <formula>` to list the formula's declared variables and their expected values","Fix typos: a provided var with a misspelled name still counts as missing because it doesn't match a declaration","Switch to interactive mode (omit `--mode=runtime`) if you want to be prompted for values instead"],"exampleFix":"// before\nbd cook deploy --mode=runtime\n// after\nbd cook deploy --mode=runtime --var env=prod --var region=us-east-1","handlingStrategy":"validation","validationCode":"missing := []string{}\nfor _, v := range declaredVars {\n    if _, ok := inputVars[v.Name]; !ok {\n        missing = append(missing, v.Name)\n    }\n}\nif len(missing) > 0 {\n    return fmt.Errorf(\"missing vars for runtime cook: %v\", missing)\n}","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"runtime mode requires all variables\") {\n        // parse Missing: list, prompt user or supply defaults\n    }\n    return err\n}","preventionTips":["Generate cook commands from the formula's declared variable list, not by hand","Pin cook invocations in scripts and update them when the formula gains variables","Prefer interactive mode when variable values aren't known ahead of time"],"tags":["formula","variables","cli","validation"],"backgroundTag":"missing-required-var","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}