nexu-io/open-design · error · SystemExit
Unknown config key: {args.key}
Error message
Unknown config key: {args.key} What it means
Raised by cmd_config in watchlist.py via `raise SystemExit(...)` when the positional `key` argument is not one of the recognized config keys. The dispatcher only knows `budget` (writes daily_budget) and `delivery` (writes delivery_channel); anything else aborts the process with a non-zero exit. SystemExit (not ValueError) means argparse/CLI semantics: the error message is printed and the process exits.
Source
Thrown at design-templates/last30days/scripts/watchlist.py:252
except json.JSONDecodeError as exc:
duration = time.time() - start_time
store.update_run(
run_id,
status="failed",
error_message=f"Invalid JSON output: {exc}",
duration_seconds=duration,
)
return {"topic": topic["name"], "status": "failed", "error": f"parse error: {exc}"}
def cmd_config(args):
if args.key == "budget":
store.set_setting("daily_budget", str(args.value))
print(json.dumps({"action": "config", "key": "daily_budget", "value": str(args.value)}))
return
if args.key == "delivery":
store.set_setting("delivery_channel", str(args.value))
print(json.dumps({"action": "config", "key": "delivery_channel", "value": str(args.value)}))
return
raise SystemExit(f"Unknown config key: {args.key}")
def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="Manage the last30days watchlist")
sub = parser.add_subparsers(dest="command")
add = sub.add_parser("add")
add.add_argument("topic")
add.add_argument("--schedule")
add.add_argument("--weekly", action="store_true")
add.add_argument("--queries")
add.set_defaults(func=cmd_add)
remove = sub.add_parser("remove")
remove.add_argument("topic")
remove.set_defaults(func=cmd_remove)
list_parser = sub.add_parser("list")View on GitHub (pinned to 5be4028344)
Solutions
- Use a supported key: `watchlist config budget <number>` or `watchlist config delivery <channel>`.
- Run `watchlist config --help` (or read cmd_config in watchlist.py:240) to see the accepted keys for your installed version.
- If you need a setting that is not budget/delivery, check store.set_setting's known keys and environment variables (OD_*) instead of guessing a config subcommand.
- If wrapping this CLI from another script, validate the key against {'budget','delivery'} before invoking to produce a cleaner error.
Example fix
// before python3 watchlist.py config interval 60 # -> SystemExit: Unknown config key: interval // after python3 watchlist.py config delivery slack # or for budget python3 watchlist.py config budget 30
Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED_CONFIG_KEYS = {"budget", "delivery"}
if args.key not in SUPPORTED_CONFIG_KEYS:
raise SystemExit(
f"Unknown config key: {args.key}. "
f"Supported: {', '.join(sorted(SUPPORTED_CONFIG_KEYS))}"
)
# then dispatch Prevention
- When wrapping watchlist from a script, validate the key against the known set before invoking.
- Expose supported keys via `watchlist config --help` or `--list-keys`.
- Treat SystemExit from this CLI as a user-input error and surface the message to the end user.
- Keep a single source of truth for supported keys (a module constant) and derive both dispatch and help from it.
When it happens
Trigger: Invoking `watchlist config <unknown> <value>` with a key other than 'budget' or 'delivery' — e.g. `watchlist config interval 60`, `watchlist config source hn`, typos like `watchlist config delivry slack`, or guessing a key name from a different tool version.
Common situations: User assumes config keys mirror CLI flags or environment variables; outdated documentation/blog lists a key that was renamed or removed; tab-completion or shell history replay with a stale key; script wrapper passing user input straight through without validation.
Related errors
- invalid JSON in ${filePath}: ${message}
- ${filePath} must contain a JSON object
- --schedule is required. Forms: hourly:<minute> | daily:HH:MM
- --schedule hourly requires :<minute>, 0-59
- --schedule ${kind} requires :HH:MM[:TZ]
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/ccc9b1234377dd11.
Report an issue: GitHub.