{"record":{"id":"75999844fd1622c2","repo":"gastownhall/beads","slug":"cannot-combine-s","errorCode":null,"errorMessage":"cannot combine %s","messagePattern":"cannot combine (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/flags.go","lineNumber":286,"sourceCode":"\tif src.flagSet || src.flagText != \"\" {\n\t\tsources = append(sources, source{src.flagName, func() (string, error) {\n\t\t\treturn src.flagText, nil\n\t\t}})\n\t}\n\n\tprovided = len(sources) > 0 || len(src.positional) > 0\n\tswitch len(sources) {\n\tcase 0:\n\t\treturn \"\", provided, nil\n\tcase 1:\n\t\ttext, err = sources[0].resolve()\n\t\treturn text, provided, err\n\tdefault:\n\t\tnames := make([]string, len(sources))\n\t\tfor i, s := range sources {\n\t\t\tnames[i] = s.name\n\t\t}\n\t\treturn \"\", provided, fmt.Errorf(\"cannot combine %s\", strings.Join(names, \" with \"))\n\t}\n}\n\n// cmdTextSources builds textSources from a command's --stdin and --file\n// flags (either may be unregistered) plus its positional text args. Callers\n// with a command-specific text flag fill in flagText/flagName themselves.\nfunc cmdTextSources(cmd *cobra.Command, positional []string) textSources {\n\tsrc := textSources{positional: positional}\n\tif stdinFlag, _ := cmd.Flags().GetBool(\"stdin\"); stdinFlag {\n\t\tsrc.stdin = os.Stdin\n\t}\n\tsrc.filePath, _ = cmd.Flags().GetString(\"file\")\n\treturn src\n}\n\n// registerTextSourceFlags registers the shared text-source flags — --stdin\n// and --file, read back by name in cmdTextSources — and marks them mutually\n// exclusive with each other and with any command-specific text flags (e.g.","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/flags.go#L268-L304","documentation":"This error is returned by textFromSources in cmd/bd/flags.go when a command is given more than one mutually exclusive text source at once (e.g. --stdin together with --file, or either combined with positional text args). The names of all provided sources are joined with ' with ' in the message. These sources are deliberately exclusive because only one can supply the command's text input.","triggerScenarios":"Invoking a bd command with two or more text sources simultaneously, e.g. `bd create \"text\" --stdin`, `bd create \"text\" --file f.txt`, or `bd ... --stdin --file f.txt`. textFromSources hits the default branch when len(sources) > 1.","commonSituations":"Scripted invocations that pass both a heredoc/piped stdin and a positional description; shell wrappers that append --stdin unconditionally while the user also supplied --file or positional text; copy-pasted commands accumulating both flags.","solutions":["Remove all but one text source: keep positional text OR --stdin OR --file.","If scripting, conditionally add --stdin only when no positional text or --file is passed.","Review the command's help output to see which text input flags are supported and exclusive."],"exampleFix":"// before\necho \"desc\" | bd create \"title\" --stdin --file notes.txt\n// after\necho \"desc\" | bd create \"title\" --stdin","handlingStrategy":"validation","validationCode":"// shell: ensure only one text source\nsources=0\n[ -n \"$POSITIONAL\" ] && sources=$((sources+1))\n[ $USE_STDIN -eq 1 ] && sources=$((sources+1))\n[ -n \"$FILE_FLAG\" ] && sources=$((sources+1))\n[ $sources -le 1 ] || { echo \"cannot combine text sources\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Decide one canonical input channel per script (usually --stdin or --file).","Conditionally add --stdin only when no positional text exists.","Review bd command help for which text flags are exclusive.","Avoid blanket wrapper flags that append --stdin unconditionally."],"tags":["cli","flags","argument-parsing"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}