github/spec-kit · error

Error: {arg} requires a value

Error message

Error: {arg} requires a value

What it means

create_new_feature.py's hand-rolled argv parser requires --short-name and --number to be followed by a value. It rejects the call when the flag is the last argument or the next token starts with '--' (i.e. looks like another flag), printing this error to stderr and exiting with code 1.

Source

Thrown at scripts/python/create_new_feature.py:131

    allow_existing = False
    short_name = ""
    branch_number = ""
    use_timestamp = False
    rest: list[str] = []

    i = 0
    while i < len(argv):
        arg = argv[i]
        if arg == "--json":
            json_mode = True
        elif arg == "--dry-run":
            dry_run = True
        elif arg == "--allow-existing-branch":
            allow_existing = True
        elif arg in {"--short-name", "--number"}:
            if i + 1 >= len(argv) or argv[i + 1].startswith("--"):
                print(f"Error: {arg} requires a value", file=sys.stderr)
                raise SystemExit(1)
            i += 1
            if arg == "--short-name":
                short_name = argv[i]
            else:
                branch_number = argv[i]
        elif arg == "--timestamp":
            use_timestamp = True
        elif arg in {"--help", "-h"}:
            sys.stdout.write(_help_text(argv0))
            raise SystemExit(0)
        else:
            rest.append(arg)
        i += 1

    description = " ".join(rest).strip()
    if not description:
        if rest:
            print(

View on GitHub (pinned to bf88c9f9a8)

Solutions

  1. Supply a value immediately after the flag: --short-name my-feature or --number 1234.
  2. If the value legitimately starts with '--' (rare), choose a different value — the parser intentionally cannot accept it.
  3. In scripts, guard empty variables before building the command: only append "--short-name $NAME" when NAME is non-empty.

Example fix

# before
cmd=(python create_new_feature.py --short-name --json "Add login")
# after
name=""
[ -n "$name" ] && cmd+=(--short-name "$name")
cmd+=(--json "Add login")
Defensive patterns

Strategy: validation

Validate before calling

import sys

VALUE_FLAGS = {"--short-name", "--number"}

def argv_is_well_formed(argv: list[str]) -> bool:
    for i, a in enumerate(argv):
        if a in VALUE_FLAGS:
            if i + 1 >= len(argv) or argv[i + 1].startswith("--"):
                return False
    return True

if not argv_is_well_formed(sys.argv[1:]):
    sys.exit("--short-name/--number each require a non-flag value")

Try / catch

try:
    args = parse_args(argv)
except SystemExit as e:
    # argparse-style exit(1) on bad flags; inspect stderr message if needed
    raise

Prevention

When it happens

Trigger: Running scripts/python/create_new_feature.py "desc" --short-name (flag last), or --short-name --json (value looks like a flag), or forgetting the value entirely: --number without the issue number.

Common situations: Shell quoting mistakes where the intended value ends up in a separate argument or is dropped; copy-pasting a command from docs that used a placeholder like <name> the user replaced with nothing; CI scripts constructing the command dynamically with an empty variable producing '--short-name --allow-existing-branch'.

Related errors


AI-assisted analysis of github/spec-kit@bf88c9f9a8 (2026-08-14). Data as JSON: /api/errors/2043a5a87da5f035. Report an issue: GitHub.