gastownhall/beads · error

line %d: unsupported batch command %q (supported: close, upd

Error message

line %d: unsupported batch command %q (supported: close, update, create, dep add, dep remove)

What it means

Batch mode supports only `close`, `update`, `create`, `dep add`, and `dep remove`. Any line whose first token is not one of these causes `parseBatchScript` to reject the entire script (before any writes) and report the unsupported command with the list of supported ones.

Source

Thrown at cmd/bd/batch.go:288

			op.args = tokens[1:]
		case "create":
			op.cmd = "create"
			op.args = tokens[1:]
		case "dep":
			if len(tokens) < 2 {
				return nil, fmt.Errorf("line %d: 'dep' requires a subcommand (add|remove)", lineNo)
			}
			switch tokens[1] {
			case "add":
				op.cmd = "dep.add"
			case "remove", "rm":
				op.cmd = "dep.remove"
			default:
				return nil, fmt.Errorf("line %d: unknown dep subcommand %q (want add|remove)", lineNo, tokens[1])
			}
			op.args = tokens[2:]
		default:
			return nil, fmt.Errorf("line %d: unsupported batch command %q (supported: close, update, create, dep add, dep remove)", lineNo, tokens[0])
		}
		ops = append(ops, op)
	}
	if err := scanner.Err(); err != nil {
		return nil, err
	}
	return ops, nil
}

// tokenizeBatchLine splits a line into whitespace-separated tokens with
// support for double-quoted strings. Escape sequences inside quotes: \" and
// \\. Anything else after a backslash inside quotes is treated literally.
func tokenizeBatchLine(s string) ([]string, error) {
	var tokens []string
	var cur strings.Builder
	inQuote := false
	hasToken := false
	for i := 0; i < len(s); i++ {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Rewrite the reported line using only close/update/create/dep add/dep remove.
  2. Run unsupported operations as separate `bd` commands outside the batch file.
  3. Fix typos in supported command names (e.g. `clos` -> `close`).
  4. Validate the whole script with `bd batch --dry-run` before executing.

Example fix

// before (batch file)
delete bd-1
// after
close bd-1
Defensive patterns

Strategy: validation

Validate before calling

# Check first tokens against the supported command set:
awk '!/^#/ && NF && !($1=="close"||$1=="update"||$1=="create"||$1=="dep") { print "line " NR ": unsupported: " $1 }' batch.txt

Try / catch

if err := runBdBatch(file); err != nil {
    if strings.Contains(err.Error(), "unsupported batch command") {
        return fmt.Errorf("rewrite the line using close/update/create/dep add/dep remove: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: A batch script line starting with an unknown command, e.g. `delete bd-1`, `comment bd-1 "note"`, or a regular CLI verb not implemented in batch mode, passed to `bd batch`.

Common situations: Scripts written for `bd create`-style CLI syntax pasted into batch mode; generated scripts using verbs from other tools; typos like `clos`.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/ebdb2c280d2a15db. Report an issue: GitHub.