{"record":{"id":"f72aa58e503a08b9","repo":"gastownhall/beads","slug":"positional-argument-q-contains-which-no-issu","errorCode":null,"errorMessage":"positional argument %q contains '=', which no issue id does — this is a mis-typed flag value; repeat the flag per pair, e.g. --set-metadata a=1 --set-metadata b=2","messagePattern":"positional argument %q contains '=', which no issue id does — this is a mis-typed flag value; repeat the flag per pair, e\\.g\\. --set-metadata a=1 --set-metadata b=2","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/update.go","lineNumber":850,"sourceCode":"// updateIDFailure records one issue ID that could not be updated and why.\n// GuardMismatch marks a --if-assignee/--if-status refusal so JSON consumers\n// can distinguish it without parsing the error text.\ntype updateIDFailure struct {\n\tID            string `json:\"id\"`\n\tError         string `json:\"error\"`\n\tGuardMismatch bool   `json:\"guard_mismatch,omitempty\"`\n}\n\n// errStrayFlagValuePositional refuses, before any write, a positional argument\n// that contains '='. --set-metadata takes ONE key=value per flag, so\n// `--set-metadata a=1 b=2` silently turns `b=2` into a positional issue id;\n// no issue id contains '=', so such a positional is unambiguously a mis-typed\n// flag value. Rejecting it up front prevents a partial write that would apply\n// only the pairs that happened to bind to a flag (bd-5247).\nfunc errStrayFlagValuePositional(args []string) error {\n\tfor _, arg := range args {\n\t\tif strings.Contains(arg, \"=\") {\n\t\t\treturn fmt.Errorf(\"positional argument %q contains '=', which no issue id does — this is a mis-typed flag value; repeat the flag per pair, e.g. --set-metadata a=1 --set-metadata b=2\", arg)\n\t\t}\n\t}\n\treturn nil\n}\n\n// reportUpdateFailures emits a per-ID failure report on stderr and returns a\n// nonzero exit error — ExitGuardMismatch when every failure is a\n// --if-assignee/--if-status guard refusal, 1 otherwise. In --json mode the\n// report is a single compact JSON line — the last line on stderr — so\n// callers can parse which IDs failed while stdout keeps the plain\n// array-of-updated-issues success shape. In text mode the individual errors\n// were already printed inline; this adds a summary naming every failed ID.\nfunc reportUpdateFailures(failures []updateIDFailure, total int) error {\n\tmsg := fmt.Sprintf(\"%d of %d issues failed to update\", len(failures), total)\n\tif jsonOutput {\n\t\tinner := map[string]interface{}{\n\t\t\t\"error\":  msg,\n\t\t\t\"failed\": failures,","sourceCodeStart":832,"sourceCodeEnd":868,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/update.go#L832-L868","documentation":"bd update rejects any positional argument containing '=' because issue IDs never contain '='; such an argument is unambiguously a flag value that failed to bind to its flag. Rejecting it up front prevents a partial write that would apply only some of the intended metadata pairs (bd-5247).","triggerScenarios":"Invoking `bd update bd-1 --set-metadata a=1 b=2` — only the first pair binds to --set-metadata (cobra consumes one value per occurrence), leaving `b=2` as a stray positional, which errStrayFlagValuePositional detects.","commonSituations":"Users assuming --set-metadata accepts multiple pairs in one value or as trailing variadic args; scripts converted from other tools' `--meta k1=v1 k2=v2` style; copy-pasted commands with missing repeated flag names.","solutions":["Repeat the flag per pair: --set-metadata a=1 --set-metadata b=2","Remove the stray positional or bind it to the intended flag","Re-run with only the issue ID as the positional argument"],"exampleFix":"// before\nbd update bd-42 --set-metadata a=1 b=2\n// after\nbd update bd-42 --set-metadata a=1 --set-metadata b=2","handlingStrategy":"validation","validationCode":"args := cmd.Flags().Args()\nfor _, a := range args {\n    if strings.Contains(a, \"=\") {\n        return fmt.Errorf(\"positional %q looks like an unbound flag value; repeat the flag per pair\", a)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never pass multiple pairs after a single flag — cobra binds one value per flag occurrence","Repeat --set-metadata for each pair","Keep the issue ID as the only positional argument"],"tags":["cli","argument-parsing","cobra"],"backgroundTag":"invalid-flag-argument","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}