langchain-ai/deepagents · error · ValueError

Refused pricing catalog with {fetched_count} providers ({bun

Error message

Refused pricing catalog with {fetched_count} providers ({bundled_count} bundled)

What it means

The pricing-catalog fetcher refuses to replace the in-memory pricing table when a freshly fetched catalog looks implausibly small — containing no providers at all or only the bundled fallback set. This guards against a corrupted upstream catalog, breaking API change, or hijacked/mis-serving endpoint silently wiping real pricing data. The raise happens inside a guarded update, so the existing catalog stays intact and the background refresh loop treats it as a failed refresh and retries on the next interval.

Source

Thrown at libs/code/deepagents_code/cost_tracking.py:473

                _TRUNCATED_CATALOG_REPORTED = True
                logger.warning(
                    "Refusing an upstream pricing catalog listing %d providers "
                    "against %d bundled with the installed package; continuing "
                    "with the catalog already in use. Upstream data.json may be "
                    "mid-publish.",
                    fetched_count,
                    bundled_count,
                )
            # Raising rather than returning `None` keeps the last good catalog:
            # `_update_prices` installs whatever `fetch` returns, `None`
            # included, so returning would discard a healthy earlier fetch. The
            # background loop treats a raise as a failed refresh and retries on
            # the next interval.
            msg = (
                f"Refused pricing catalog with {fetched_count} providers "
                f"({bundled_count} bundled)"
            )
            raise ValueError(msg)

    return _GuardedUpdatePrices()


def _prices_auto_update_enabled() -> bool:
    """Resolve the `update.prices_auto_update` option through the manifest.

    Routing the gate through the shared resolver keeps env-over-TOML precedence
    and the `config get update.prices_auto_update` report in lockstep with what
    the updater actually does; reading the env var inline would show a user who
    opted out in `config.toml` `false` while the hourly fetch still started.

    Returns:
        `True` unless the option resolved to disabled or its manifest entry is
            missing.
    """
    from deepagents_code.config_manifest import _emit_ranked_diagnostics, get_option
    from deepagents_code.configuration.resolver import get_config_resolver

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Inspect the raw response from the pricing-catalog endpoint and confirm it contains per-provider pricing entries.
  2. Verify the catalog URL/endpoint has not been redirected or stubbed by a proxy, VPN, or captive portal.
  3. Check whether the installed library version expects a newer catalog schema than upstream serves; upgrade or pin accordingly.
  4. Re-run after transient network issues resolve — the background loop retries automatically, so no code change is needed.
Defensive patterns

Strategy: validation

Validate before calling

catalog = fetch_catalog_raw()  # inspect upstream before accepting
if len(catalog.providers) <= BUNDLED_PROVIDER_COUNT:
    skip_refresh()  # keep existing pricing table

Type guard

def catalog_looks_valid(catalog, bundled_count: int) -> bool:
    return catalog is not None and len(catalog.providers) > bundled_count

Try / catch

try:
    updater.fetch()
except ValueError as exc:
    logger.warning("Pricing refresh rejected: %s — keeping existing catalog", exc)

Prevention

When it happens

Trigger: Calling `fetch()` on the guarded pricing updater (directly or via the background auto-update loop) when the fetched catalog parses to a provider count at or below the bundled-provider count — typically 0 providers parsed from the response.

Common situations: Upstream pricing API returns an empty or malformed payload (HTML error page, truncated JSON, renamed schema field yielding zero parsed providers); a proxy or captive portal serves a stub response; SDK version expects a newer catalog schema than the server serves.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/44be94a956be4a65. Report an issue: GitHub.