langchain-ai/deepagents · error · MarketplaceError

Failed to download marketplace from {_redact_url_credentials

Error message

Failed to download marketplace from {_redact_url_credentials(url)}: {redact_urls_in_text(str(exc))}

What it means

This wraps any low-level failure during the marketplace download — DNS/socket errors (OSError), HTTP errors (URLError), or invalid JSON (JSONDecodeError) — into a single MarketplaceError. The original URL and exception text are URL-redacted so credentials never leak into logs.

Source

Thrown at libs/code/deepagents_code/plugins/marketplace.py:384

    )
    request = urllib.request.Request(  # noqa: S310  # Scheme is restricted above.
        url, headers={"User-Agent": "dcode-plugin-manager"}
    )
    opener = urllib.request.build_opener(_HttpsOnlyRedirectHandler())
    try:
        with opener.open(request, timeout=10) as response:
            final_url = response.geturl()
            if urlparse(final_url).scheme != "https":
                detail = _redact_url_credentials(final_url)
                msg = f"Marketplace response must use https: {detail}"
                raise MarketplaceError(msg)
            data = json.load(response)
    except (OSError, urllib.error.URLError, json.JSONDecodeError) as exc:
        msg = (
            "Failed to download marketplace from "
            f"{_redact_url_credentials(url)}: {redact_urls_in_text(str(exc))}"
        )
        raise MarketplaceError(msg) from exc
    if not isinstance(data, dict):
        msg = (
            f"Marketplace URL must return a JSON object: {_redact_url_credentials(url)}"
        )
        raise MarketplaceError(msg)
    cache_path.parent.mkdir(parents=True, exist_ok=True)
    cache_path.write_text(
        json.dumps(data, indent=2, sort_keys=True) + "\n", encoding="utf-8"
    )
    return cache_path


def materialize_marketplace_source(
    source: MarketplaceSource,
) -> tuple[PluginMarketplace, Path]:
    """Load a marketplace source and return its local install location.

    Args:

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Verify network connectivity and that the marketplace hostname resolves (ping/nslookup/curl)
  2. Open the marketplace URL in a browser or curl to confirm it returns valid JSON
  3. Check whether an HTTP error status (404/500) is returned and fix the URL or server
  4. Inspect certificate validity if a TLS error appears in the redacted message
  5. Retry later if the failure is transient (server down, timeout)

Example fix

# before (URL returns 404 HTML)
url = "https://example.com/wrong-path.json"
// after
url = "https://example.com/marketplace.json"  # returns a JSON object
Defensive patterns

Strategy: try-catch

Validate before calling

import urllib.request, json
with urllib.request.urlopen(marketplace_url, timeout=10) as r:
    json.load(r)  # raises early if unreachable or invalid JSON

Try / catch

try:
    marketplace, path = materialize_marketplace_source(source)
except MarketplaceError as exc:
    if str(exc).startswith("Failed to download marketplace"):
        log.error("Marketplace unreachable or invalid: %s", exc)
    else:
        raise
# optionally retry transient network failures with backoff

Prevention

When it happens

Trigger: Calling materialize_marketplace_source / _download_marketplace when: the host is unreachable or DNS fails, the connection times out (timeout=10), TLS fails, an HTTP error status is returned, or the response body is not valid JSON.

Common situations: No network or VPN required; wrong hostname in the marketplace URL; server returning an HTML error page (404/500) instead of JSON; firewall blocking egress; certificate problems.

Related errors


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