nexu-io/open-design · error · RuntimeError

No X backend is available.

Error message

No X backend is available.

What it means

Thrown by the X-source dispatch in pipeline.py when the resolved `runtime.x_search_backend` (or `env.get_x_source(config)`) does not match any of the handled backends ('bird', 'xai', 'xurl'). The code reaches the trailing RuntimeError only because every backend branch was skipped, meaning no X/Twitter data source is available for this run.

Source

Thrown at design-templates/last30days/scripts/lib/pipeline.py:912

        backend = runtime.x_search_backend or env.get_x_source(config)
        if backend == "bird":
            result = bird_x.search_x(subquery.search_query, from_date, to_date, depth=depth)
            return bird_x.parse_bird_response(result, query=subquery.search_query), {}
        if backend == "xai":
            model = config.get("LAST30DAYS_X_MODEL") or config.get("XAI_MODEL_PIN") or providers.XAI_DEFAULT
            result = xai_x.search_x(
                config["XAI_API_KEY"],
                model,
                subquery.search_query,
                from_date,
                to_date,
                depth=depth,
            )
            return xai_x.parse_x_response(result), {}
        if backend == "xurl":
            result = xurl_x.search_x(subquery.search_query, depth=depth)
            return xurl_x.parse_x_response(result, topic=subquery.search_query), {}
        raise RuntimeError("No X backend is available.")
    if source == "youtube":
        # Use raw_topic so expand_youtube_queries() generates diverse variants
        # from the original user topic, not the planner's narrowed search_query.
        yt_query = raw_topic or subquery.search_query
        result = None
        # Try yt-dlp first, fall back to SC YouTube if it fails or isn't installed
        if which("yt-dlp"):
            try:
                result = youtube_yt.search_and_transcribe(yt_query, from_date, to_date, depth=depth)
            except Exception:
                result = None
        if (result is None or not result.get("items")) and env.is_youtube_sc_available(config):
            sc_token = config.get("SCRAPECREATORS_API_KEY", "")
            result = youtube_yt.search_youtube_sc(yt_query, from_date, to_date, depth=depth, token=sc_token)
        if result is None:
            result = {"items": []}
        # Enrich top videos with comments when SC key is available
        items = youtube_yt.parse_youtube_response(result)

View on GitHub (pinned to 5be4028344)

Solutions

  1. Provide an X credential: set XAI_API_KEY (preferred) OR both AUTH_TOKEN and CT0 cookies for the bird backend.
  2. Install and authenticate the xurl CLI so env.get_x_source falls through to the oauth2 'xurl' branch.
  3. Verify LAST30DAYS_X_BACKEND is one of {xai, bird} or unset; remove any typo.
  4. If X is optional, drop 'x' from the SubQuery.sources so the planner never schedules an X retrieval.

Example fix

# before
XAI_API_KEY=
LAST30DAYS_X_BACKEND=birb

# after
XAI_API_KEY=xai-xxxxxxxx
LAST30DAYS_X_BACKEND=xai
Defensive patterns

Strategy: validation

Validate before calling

from lib import env, providers

def assert_x_backend_available(config):
    runtime_backend = providers._resolve_x_backend(config)
    resolved = runtime_backend or env.get_x_source(config)
    if resolved not in {"bird", "xai", "xurl"}:
        raise RuntimeError(
            "No X backend available; set XAI_API_KEY or AUTH_TOKEN+CT0, "
            "or install/authenticate the xurl CLI."
        )
    return resolved

Type guard

null

Try / catch

null

Prevention

When it happens

Trigger: Calling stream_results with source=='x' while runtime.x_search_backend is None or an unrecognized string. This happens when XAI_API_KEY is unset, AUTH_TOKEN/CT0 cookies are absent, and the xurl CLI is not installed/authenticated, so env.get_x_source returns None.

Common situations: Running the last30days pipeline on a fresh checkout with no .env credentials. Setting LAST30DAYS_X_BACKEND to a typo like 'bird2' or 'twiter'. Disabling xurl CLI so get_x_source_with_method returns ('none') which is not a handled branch.

Related errors


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