{"record":{"id":"667675b93d570d5e","repo":"gastownhall/beads","slug":"line-d-unknown-dep-subcommand-q-want-add-remov","errorCode":null,"errorMessage":"line %d: unknown dep subcommand %q (want add|remove)","messagePattern":"line (.+?): unknown dep subcommand %q \\(want add\\|remove\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/batch.go","lineNumber":284,"sourceCode":"\t\t\top.cmd = \"close\"\n\t\t\top.args = tokens[1:]\n\t\tcase \"update\":\n\t\t\top.cmd = \"update\"\n\t\t\top.args = tokens[1:]\n\t\tcase \"create\":\n\t\t\top.cmd = \"create\"\n\t\t\top.args = tokens[1:]\n\t\tcase \"dep\":\n\t\t\tif len(tokens) < 2 {\n\t\t\t\treturn nil, fmt.Errorf(\"line %d: 'dep' requires a subcommand (add|remove)\", lineNo)\n\t\t\t}\n\t\t\tswitch tokens[1] {\n\t\t\tcase \"add\":\n\t\t\t\top.cmd = \"dep.add\"\n\t\t\tcase \"remove\", \"rm\":\n\t\t\t\top.cmd = \"dep.remove\"\n\t\t\tdefault:\n\t\t\t\treturn nil, fmt.Errorf(\"line %d: unknown dep subcommand %q (want add|remove)\", lineNo, tokens[1])\n\t\t\t}\n\t\t\top.args = tokens[2:]\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"line %d: unsupported batch command %q (supported: close, update, create, dep add, dep remove)\", lineNo, tokens[0])\n\t\t}\n\t\tops = append(ops, op)\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ops, nil\n}\n\n// tokenizeBatchLine splits a line into whitespace-separated tokens with\n// support for double-quoted strings. Escape sequences inside quotes: \\\" and\n// \\\\. Anything else after a backslash inside quotes is treated literally.\nfunc tokenizeBatchLine(s string) ([]string, error) {\n\tvar tokens []string","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/batch.go#L266-L302","documentation":"In batch mode, `dep` only accepts `add`, `remove`, or `rm` as its subcommand. Any other second token (e.g. `dep list bd-1`) fails parsing of the entire script before any writes, with the offending subcommand quoted.","triggerScenarios":"A batch line like `dep list bd-1`, `dep show bd-1`, or a misspelled `dep remve bd-1 bd-2` passed to `bd batch`.","commonSituations":"Users trying to query dependencies inside batch scripts; typos of remove/rm; scripts mixing read commands with write commands.","solutions":["Change the subcommand to `add`, `remove`, or `rm` on the reported line.","Move read-only dependency queries out of the batch script (use `bd dep <id>` separately).","Note `rm` is accepted as an alias for `remove`.","Validate with `bd batch --dry-run` before executing."],"exampleFix":"// before (batch file)\ndep remve bd-1 bd-2\n// after\ndep remove bd-1 bd-2","handlingStrategy":"validation","validationCode":"# Verify dep subcommands are only add/remove/rm:\nawk '$1==\"dep\" && !(($2==\"add\")||($2==\"remove\")||($2==\"rm\")) { print \"line \" NR \": unknown dep subcommand: \" $2 }' batch.txt","typeGuard":null,"tryCatchPattern":"if err := runBdBatch(file); err != nil {\n    if strings.Contains(err.Error(), \"unknown dep subcommand\") {\n        return fmt.Errorf(\"fix the dep subcommand; nothing was written: %w\", err)\n    }\n    return err\n}","preventionTips":["Remember `rm` is a valid alias for `remove`; no other subcommands exist in batch mode.","Keep read commands (`dep list/show`) out of batch scripts.","Dry-run every generated script before execution."],"tags":["cli","batch","parsing","dependencies"],"backgroundTag":"batch-script-parse-error","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}