nexu-io/open-design · error · SystemExit

Unknown search source: {source}

Error message

Unknown search source: {source}

What it means

parse_search_flag() tokenizes the `--search` argument by comma, lowercases/strips each token, maps it through pipeline.SEARCH_ALIAS, and rejects any token whose normalized form is not in pipeline.MOCK_AVAILABLE_SOURCES. It raises SystemExit with the offending (pre-alias) token so the user can see exactly which entry was unrecognized. This runs during CLI argument parsing, before any network or planner work.

Source

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

    for pid in pids:
        try:
            os.killpg(os.getpgid(pid), signal.SIGTERM)
        except (ProcessLookupError, PermissionError, OSError):
            continue


atexit.register(_cleanup_children)


def parse_search_flag(raw: str) -> list[str]:
    sources = []
    for source in raw.split(","):
        source = source.strip().lower()
        if not source:
            continue
        normalized = pipeline.SEARCH_ALIAS.get(source, source)
        if normalized not in pipeline.MOCK_AVAILABLE_SOURCES:
            raise SystemExit(f"Unknown search source: {source}")
        if normalized not in sources:
            sources.append(normalized)
    if not sources:
        raise SystemExit("--search requires at least one source.")
    return sources


def slugify(value: str) -> str:
    slug = re.sub(r"[^a-z0-9]+", "-", value.lower()).strip("-")
    return slug or "last30days"


def save_output(
    report: schema.Report,
    emit: str,
    save_dir: str,
    suffix: str = "",
    synthesis_md: str | None = None,

View on GitHub (pinned to 5be4028344)

Solutions

  1. Run with `--search` omitted to use all MOCK_AVAILABLE_SOURCES, or
  2. Pass only known source names: reddit, youtube, x, xquik, github, hackernews, polymarket, threads, truthsocial, xiaohongshu, pinterest, grounding (and any aliases defined in pipeline.SEARCH_ALIAS).
  3. If you expected a source to exist, grep `SEARCH_ALIAS` and `MOCK_AVAILABLE_SOURCES` in lib/pipeline.py for the canonical spelling.
  4. Correct the typo and rerun.

Example fix

# before
python3.12 last30days.py --topic x --search reddit,yutube
# after
python3.12 last30days.py --topic x --search reddit,youtube
Defensive patterns

Strategy: validation

Validate before calling

from lib import pipeline
VALID = set(pipeline.MOCK_AVAILABLE_SOURCES) | set(pipeline.SEARCH_ALIAS.keys())
requested = [s.strip().lower() for s in raw.split(',') if s.strip()]
unknown = [s for s in requested if pipeline.SEARCH_ALIAS.get(s, s) not in pipeline.MOCK_AVAILABLE_SOURCES]
if unknown:
    raise ValueError(f'Unknown --search sources: {unknown}. Valid: {sorted(VALID)}')

Try / catch

try:
    sources = parse_search_flag(raw)
except SystemExit as e:
    print(f'fix --search: {e}', file=sys.stderr)
    sys.exit(2)

Prevention

When it happens

Trigger: Passing `--search reddit,yutube` (typo), `--search google-news` (not a registered source), `--search RSS` after lowercasing yields `rss` which is not in MOCK_AVAILABLE_SOURCES, or any token not present in SEARCH_ALIAS and not a real source name.

Common situations: Typos; copying a source name from outdated docs; using a provider-only label (e.g. `openai`) instead of a content source; case/whitespace surprises are handled, so a residual failure is a genuinely unknown name.

Related errors


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