{"record":{"id":"52aec0f01088bd41","repo":"langchain-ai/deepagents","slug":"failed-to-download-marketplace-from-redact-url-c","errorCode":null,"errorMessage":"Failed to download marketplace from {_redact_url_credentials(url)}: {redact_urls_in_text(str(exc))}","messagePattern":"Failed to download marketplace from (.+?): (.+?)","errorType":"exception","errorClass":"MarketplaceError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/plugins/marketplace.py","lineNumber":384,"sourceCode":"    )\n    request = urllib.request.Request(  # noqa: S310  # Scheme is restricted above.\n        url, headers={\"User-Agent\": \"dcode-plugin-manager\"}\n    )\n    opener = urllib.request.build_opener(_HttpsOnlyRedirectHandler())\n    try:\n        with opener.open(request, timeout=10) as response:\n            final_url = response.geturl()\n            if urlparse(final_url).scheme != \"https\":\n                detail = _redact_url_credentials(final_url)\n                msg = f\"Marketplace response must use https: {detail}\"\n                raise MarketplaceError(msg)\n            data = json.load(response)\n    except (OSError, urllib.error.URLError, json.JSONDecodeError) as exc:\n        msg = (\n            \"Failed to download marketplace from \"\n            f\"{_redact_url_credentials(url)}: {redact_urls_in_text(str(exc))}\"\n        )\n        raise MarketplaceError(msg) from exc\n    if not isinstance(data, dict):\n        msg = (\n            f\"Marketplace URL must return a JSON object: {_redact_url_credentials(url)}\"\n        )\n        raise MarketplaceError(msg)\n    cache_path.parent.mkdir(parents=True, exist_ok=True)\n    cache_path.write_text(\n        json.dumps(data, indent=2, sort_keys=True) + \"\\n\", encoding=\"utf-8\"\n    )\n    return cache_path\n\n\ndef materialize_marketplace_source(\n    source: MarketplaceSource,\n) -> tuple[PluginMarketplace, Path]:\n    \"\"\"Load a marketplace source and return its local install location.\n\n    Args:","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/plugins/marketplace.py#L366-L402","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify network connectivity and that the marketplace hostname resolves (ping/nslookup/curl)","Open the marketplace URL in a browser or curl to confirm it returns valid JSON","Check whether an HTTP error status (404/500) is returned and fix the URL or server","Inspect certificate validity if a TLS error appears in the redacted message","Retry later if the failure is transient (server down, timeout)"],"exampleFix":"# before (URL returns 404 HTML)\nurl = \"https://example.com/wrong-path.json\"\n// after\nurl = \"https://example.com/marketplace.json\"  # returns a JSON object","handlingStrategy":"try-catch","validationCode":"import urllib.request, json\nwith urllib.request.urlopen(marketplace_url, timeout=10) as r:\n    json.load(r)  # raises early if unreachable or invalid JSON","typeGuard":null,"tryCatchPattern":"try:\n    marketplace, path = materialize_marketplace_source(source)\nexcept MarketplaceError as exc:\n    if str(exc).startswith(\"Failed to download marketplace\"):\n        log.error(\"Marketplace unreachable or invalid: %s\", exc)\n    else:\n        raise\n# optionally retry transient network failures with backoff","preventionTips":["Check network/DNS/VPN before installing marketplaces","Confirm the URL returns JSON via curl before adding it","Add retry with backoff for transient timeouts"],"tags":["network","http","json","timeout"],"backgroundTag":"marketplace-download-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}