{"record":{"id":"cc1dfa7d26bf7f38","repo":"gastownhall/beads","slug":"neither-s-nor-s-found-in-epic-text","errorCode":null,"errorMessage":"neither '%s' nor '%s' found in epic text","messagePattern":"neither '(.+?)' nor '(.+?)' found in epic text","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/mol_distill.go","lineNumber":101,"sourceCode":"\tleft, right := parts[0], parts[1]\n\tleftFound := strings.Contains(searchableText, left)\n\trightFound := strings.Contains(searchableText, right)\n\n\tswitch {\n\tcase rightFound && !leftFound:\n\t\t// spawn-style: --var branch=feature-auth\n\t\t// left is variable name, right is the value to find\n\t\treturn right, left, nil\n\tcase leftFound && !rightFound:\n\t\t// substitution-style: --var feature-auth=branch\n\t\t// left is value to find, right is variable name\n\t\treturn left, right, nil\n\tcase leftFound && rightFound:\n\t\t// Both found - prefer spawn-style (more natural guess)\n\t\t// Agent likely typed: --var varname=concrete_value\n\t\treturn right, left, nil\n\tdefault:\n\t\treturn \"\", \"\", fmt.Errorf(\"neither '%s' nor '%s' found in epic text\", left, right)\n\t}\n}\n\ntype molDistillInput struct {\n\tepicID         string\n\tformulaNameArg string\n\tvarFlags       []string\n\tdryRun         bool\n\toutputDir      string\n}\n\nfunc gatherMolDistillInput(cmd *cobra.Command, args []string) molDistillInput {\n\tin := molDistillInput{epicID: args[0]}\n\tin.varFlags, _ = cmd.Flags().GetStringArray(\"var\")\n\tin.dryRun, _ = cmd.Flags().GetBool(\"dry-run\")\n\tin.outputDir, _ = cmd.Flags().GetString(\"output\")\n\tif len(args) > 1 {\n\t\tin.formulaNameArg = args[1]","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/mol_distill.go#L83-L119","documentation":"After `parseDistillVar` splits the `--var` flag into a left and right side, at least one side must literally appear in the epic's searchable text so the command can decide which side is the variable name. If neither the left nor the right string is found in the epic text, the flag is ambiguous/invalid and distillation aborts.","triggerScenarios":"Running `bd mol distill --var 'foo=bar'` (from `distillSubgraph`) where neither `foo` nor `bar` occurs anywhere in the target epic's title/description text. Both `leftFound` and `rightFound` are false, so the `default` branch returns this error.","commonSituations":"Typos between the flag value and the epic text; the epic was renamed/edited after the command line was scripted; case mismatch (text search is case-sensitive); passing a variable name that only exists in your head, not in the epic content.","solutions":["Read the epic (`bd show <epic-id>`) and use an exact substring of its text on one side of the `=`.","Fix typos or case differences so one side of the flag matches text in the epic verbatim.","Use the spawn-style `variable=value` form with an existing value, e.g. `--var epic_name=<exact text from epic>`."],"exampleFix":"// before\nbd mol distill --epic bd-42 --var epic_name=AutH Refactor\n// after\nbd mol distill --epic bd-42 --var epic_name=Auth Refactor   // exact text from the epic","handlingStrategy":"validation","validationCode":"// shell: ensure one side of --var exists in the epic text before invoking\nEPIC=$(bd show bd-42 --json | jq -r '.title + \" \" + .description')\nVAR='epic_name=Auth Refactor'\nL=${VAR%%=*}; R=${VAR#*=}\n[[ \"$EPIC\" == *\"$L\"* || \"$EPIC\" == *\"$R\"* ]] || { echo \"neither side found in epic text\"; exit 1; }\nbd mol distill --epic bd-42 --var \"$VAR\"","typeGuard":"func varSideFound(flag, epicText string) bool {\n\tp := strings.SplitN(flag, \"=\", 2)\n\tif len(p) != 2 {\n\t\treturn false\n\t}\n\treturn strings.Contains(epicText, p[0]) || strings.Contains(epicText, p[1])\n}","tryCatchPattern":"if err := runDistill(); err != nil && strings.Contains(err.Error(), \"neither\") {\n\tfmt.Fprintln(os.Stderr, \"use text that appears verbatim in the epic\")\n}","preventionTips":["Copy the match text directly from `bd show <epic-id>` output, never retype it.","Remember the lookup is a case-sensitive substring search.","Re-verify flags after editing or renaming an epic."],"tags":["cli","text-matching","argument-validation"],"backgroundTag":"text-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}