nexu-io/open-design · error

[Competitors] --competitors-list is empty.\n

Error message

[Competitors] --competitors-list is empty.\n

What it means

In resolve_competitors() (around line 433), when `--competitors-list` is provided (not None) the code splits on comma, strips, and discards empty entries. If the resulting explicit_list is empty, it writes `[Competitors] --competitors-list is empty.` to stderr and raises SystemExit(2). This catches `--competitors-list ''`, `--competitors-list ',,'`, etc. before any count logic runs.

Source

Thrown at design-templates/last30days/scripts/last30days.py:433

def resolve_competitors_args(args: argparse.Namespace) -> tuple[bool, int, list[str]]:
    """Normalize --competitors / --competitors-list into (enabled, count, explicit_list).

    - (False, 0, []) when neither flag is set.
    - An explicit list always wins; count is derived from list length.
    - A numeric count outside [1, 6] is clamped with a stderr warning.
    - count <= 0 (explicit) raises SystemExit(2).
    """
    explicit_list: list[str] = []
    list_flag_provided = args.competitors_list is not None
    if list_flag_provided:
        explicit_list = [
            entity.strip()
            for entity in args.competitors_list.split(",")
            if entity.strip()
        ]
        if not explicit_list:
            sys.stderr.write("[Competitors] --competitors-list is empty.\n")
            raise SystemExit(2)

    competitors_flag = args.competitors
    list_present = bool(explicit_list)
    flag_present = competitors_flag is not None

    if not list_present and not flag_present:
        return False, 0, []

    if list_present:
        count = len(explicit_list)
        if flag_present and competitors_flag != count:
            sys.stderr.write(
                f"[Competitors] --competitors={competitors_flag} ignored; using "
                f"{count} entries from --competitors-list.\n"
            )
        if count > COMPETITORS_MAX:
            sys.stderr.write(
                f"[Competitors] --competitors-list has {count} entries, clamping to {COMPETITORS_MAX}.\n"

View on GitHub (pinned to 5be4028344)

Solutions

  1. Provide at least one entity name: `--competitors-list acme,beta`.
  2. Drop the flag entirely if you want auto-discovery via `--competitors N`.
  3. Guard the shell variable: `--competitors-list "${LIST:-acme}"`.

Example fix

# before
python3.12 last30days.py --topic x --competitors-list "$CLIST"   # CLIST empty
# after
python3.12 last30days.py --topic x --competitors-list "${CLIST:-acme,beta}"
Defensive patterns

Strategy: validation

Validate before calling

explicit = [e.strip() for e in (args.competitors_list or '').split(',') if e.strip()]
if args.competitors_list is not None and not explicit:
    raise ValueError('--competitors-list must contain at least one non-empty entity')

Prevention

When it happens

Trigger: `--competitors-list ""`, `--competitors-list ","`, or `--competitors-list " , "` — flag present but every token empty after strip.

Common situations: Empty env var expanded into the flag; a templated command where the list variable was unset; user misunderstanding the flag as boolean.

Related errors


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/3cedf78e354ff2df. Report an issue: GitHub.