mvanhorn/last30days-skill · error · SystemExit

Unknown search source in {flag_name}: {source}

Error message

Unknown search source in {flag_name}: {source}

What it means

parse_search_flag() validates each comma-separated entry of --search (and sibling flags) against pipeline.MOCK_AVAILABLE_SOURCES after applying SEARCH_ALIAS normalization. Any token that is neither a known source name nor a registered alias aborts with SystemExit before the run starts.

Source

Thrown at skills/last30days/scripts/last30days.py:94

                os.killpg(os.getpgid(pid), signal.SIGTERM)
            else:
                os.kill(pid, signal.SIGTERM)
        except (ProcessLookupError, PermissionError, OSError):
            continue


atexit.register(_cleanup_children)


def parse_search_flag(raw: str, flag_name: str = "--search") -> 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 in {flag_name}: {source}")
        if normalized not in sources:
            sources.append(normalized)
    if not sources:
        raise SystemExit(f"{flag_name} requires at least one source.")
    return sources

def parse_as_of_date_arg(value: str) -> str:
    try:
        parsed = dates.parse_as_of_date(value)
    except ValueError as exc:
        raise argparse.ArgumentTypeError(str(exc)) from exc
    return parsed

def resolve_requested_sources(args_search: str | None, config: dict) -> list[str] | None:
    """Resolve the requested source set: explicit --search wins, then the
    LAST30DAYS_DEFAULT_SEARCH config key (env var or .env file), then None
    (per-query default behavior). The config fallback lets users pin a fixed
    source set that survives upgrades without patching SKILL.md (#442).

View on GitHub (pinned to c7460f6114)

Solutions

  1. Run the engine's help or inspect pipeline.MOCK_AVAILABLE_SOURCES / SEARCH_ALIAS to list valid source tokens and aliases.
  2. Correct or remove the offending token from the --search value in your command.
  3. If you expected the source to exist, update the installed skill copy (npx skills add . -g -y) — your frozen ~/.agents/skills copy may be older than the docs you read.

Example fix

# before
--search reddit,hackernews,mmaspace

# after
--search reddit,hackernews
Defensive patterns

Strategy: validation

Validate before calling

from lib import pipeline
valid = set(pipeline.MOCK_AVAILABLE_SOURCES) | set(pipeline.SEARCH_ALIAS)
requested = [s.strip().lower() for s in raw.split(',') if s.strip()]
unknown = [s for s in requested if s not in valid and pipeline.SEARCH_ALIAS.get(s, s) not in pipeline.MOCK_AVAILABLE_SOURCES]
assert not unknown, f'unknown sources: {unknown}'

Type guard

def is_known_source(token: str) -> TypeGuard[str]:
    t = token.strip().lower()
    return pipeline.SEARCH_ALIAS.get(t, t) in pipeline.MOCK_AVAILABLE_SOURCES

Prevention

When it happens

Trigger: Passing e.g. --search reddit,mmaspace or a typo like 'reditt'; using a source name that only exists in a newer/older engine revision; passing a platform token that requires normalization not present in SEARCH_ALIAS (case is handled by .lower(), but new/renamed sources are not).

Common situations: Typos in agent-authored CLI args; a source renamed between skill versions (e.g. 'twitter' vs 'x' if the alias was removed); SKILL.md examples drifting from the engine's source list.

Related errors


AI-assisted analysis of mvanhorn/last30days-skill@c7460f6114 (2026-08-15). Data as JSON: /api/errors/0b62b291f4913789. Report an issue: GitHub.