mvanhorn/last30days-skill · error · SourceRunError

Reddit primary and fallback produced no results after failur

Error message

Reddit primary and fallback produced no results after failure: {failure}

What it means

SourceRunError raised in the Reddit fetch path when ScrapeCreators was the primary (keyed) strategy: the primary call failed AND the public fallback either failed or returned nothing, so failure = public_failure or primary_failure. The error carries a failure state from reddit.classify_run_failure (e.g. AUTH_FAILED, RATE_LIMITED) so callers can react to the class of failure, not just the message. Both the paid and free Reddit paths are exhausted — no data can be returned for this subquery.

Source

Thrown at skills/last30days/scripts/lib/pipeline.py:4126

                            state,
                            f"Reddit primary failed; public fallback returned "
                            f"{len(public_results)} items: {primary_failure}",
                        )
                    return public_results, {}
                sys.stderr.write(
                    "[Reddit] Public fallback returned no items after "
                    "ScrapeCreators primary miss\n"
                )
            except Exception as exc:
                public_failure = exc
                sys.stderr.write(
                    f"[Reddit] Public fallback also failed "
                    f"({type(exc).__name__}: {exc})\n"
                )
            failure = public_failure or primary_failure
            if failure is not None:
                state = reddit.classify_run_failure(str(failure))
                raise SourceRunError(
                    f"Reddit primary and fallback produced no results after failure: {failure}",
                    state,
                )
            return [], {}

        # Default: public Reddit first (free). ScrapeCreators backfills when the
        # free path is empty OR returns fewer than the configured thinness floor
        # (env.REDDIT_SC_MIN_ITEMS_VAR, default 0 = empty-only — today's
        # behavior, no extra credit spend unless the user opts in).
        try:
            min_items = int(config.get(env.REDDIT_SC_MIN_ITEMS_VAR) or 0)
        except (TypeError, ValueError):
            min_items = 0
        public_results: list[dict] = []
        public_failure: Exception | None = None
        try:
            public_results = reddit_public.search_reddit_public(
                reddit_query, from_date, to_date, depth=depth,

View on GitHub (pinned to c7460f6114)

Solutions

  1. Inspect the embedded failure state (SourceRunError.state / classify_run_failure) — AUTH_FAILED means fix the ScrapeCreators key, RATE_LIMITED means back off and retry.
  2. Verify the ScrapeCreators key works: curl the API with a minimal request and check the HTTP status.
  3. If Reddit public is IP-blocked, wait or route via a different network; the public fallback is free but not guaranteed.
  4. Retry the run after the transient condition clears; this error is per-source, so other sources may still succeed if you let the pipeline continue.

Example fix

# before
items, meta = fetch_reddit(subquery, ...)

# after
try:
    items, meta = fetch_reddit(subquery, ...)
except SourceRunError as exc:
    if exc.state == "AUTH_FAILED":
        log("Reddit credentials invalid; skipping source")
    raise_if_no_sources_left(exc)
Defensive patterns

Strategy: retry

Try / catch

try:
    items, meta = fetch_reddit(...)
except SourceRunError as exc:
    if exc.state == "AUTH_FAILED":
        raise  # credentials are broken; retrying will not help
    time.sleep(backoff)
    items, meta = fetch_reddit(...)  # one retry for RATE_LIMITED / transient

Prevention

When it happens

Trigger: SCRAPECREATORS_API_KEY present and reddit resolves to the ScrapeCreators primary; ScrapeCreators raises (401/429/5xx); the code then tries reddit_public.search_reddit_public as fallback; that also raises (network down, Reddit blocking) or returns [] — with a failure recorded, SourceRunError is raised with the combined state.

Common situations: Expired or revoked ScrapeCreators key plus Reddit public endpoints blocked/rate-limited from the host IP; total network outage; Reddit rate limiting during heavy bursts; ScrapeCreators quota exhausted while Reddit public search is also throttled.

Related errors


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