{"record":{"id":"830d47b6aa1f62c7","repo":"langchain-ai/deepagents","slug":"marketplace-redirect-must-use-https-detail","errorCode":null,"errorMessage":"Marketplace redirect must use https: {detail}","messagePattern":"Marketplace redirect must use https: (.+?)","errorType":"exception","errorClass":"MarketplaceError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/plugins/marketplace.py","lineNumber":355,"sourceCode":"    cache_key: str,\n) -> Path:\n    return _clone_repository_to_cache(source, git_url, cache_key=cache_key)\n\n\nclass _HttpsOnlyRedirectHandler(urllib.request.HTTPRedirectHandler):\n    def redirect_request(\n        self,\n        req: urllib.request.Request,\n        fp: IO[bytes],\n        code: int,\n        msg: str,\n        headers: HTTPMessage,\n        newurl: str,\n    ) -> urllib.request.Request | None:\n        if urlparse(newurl).scheme != \"https\":\n            detail = _redact_url_credentials(newurl)\n            error = f\"Marketplace redirect must use https: {detail}\"\n            raise MarketplaceError(error)\n        return super().redirect_request(req, fp, code, msg, headers, newurl)\n\n\ndef _download_marketplace(url: str) -> Path:\n    parsed = urlparse(url)\n    if parsed.scheme != \"https\":\n        msg = f\"Marketplace URL must use https: {_redact_url_credentials(url)}\"\n        raise MarketplaceError(msg)\n    cache_path = (\n        ensure_marketplace_cache_dir() / f\"marketplace-url-{opaque_cache_key(url)}.json\"\n    )\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()","sourceCodeStart":337,"sourceCodeEnd":373,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/plugins/marketplace.py#L337-L373","documentation":"This error is raised by the custom HTTPS redirect handler used when downloading a marketplace catalog. urllib followed an HTTP 3xx redirect, but the redirect target URL does not use the https scheme, so the library refuses the redirect to prevent a secure request from being downgraded to plaintext HTTP. The target URL is credential-redacted before being included in the message.","triggerScenarios":"Calling any marketplace download flow (e.g. adding a URL-based marketplace via materialize_marketplace_source -> _download_marketplace) where the server responds with a redirect (301/302/307/308) to an http:// or other non-https URL.","commonSituations":"A marketplace host misconfigured to redirect https traffic to plain http; a CDN or load balancer terminating TLS and forwarding over http; a typo'd or stale canonical URL configured on the server.","solutions":["Fix the server/CDN redirect so the Location header points to an https:// URL","Serve the marketplace directly over https with no redirect chain that exits TLS","Verify the configured marketplace URL is correct; a wrong hostname may land on a server that redirects to http","If you control the infrastructure, enable HTTPS on the redirect target"],"exampleFix":"// before (server config redirects to http)\nRedirect permanent / http://cdn.example.com/marketplace.json\n// after\nRedirect permanent / https://cdn.example.com/marketplace.json","handlingStrategy":"try-catch","validationCode":"from urllib.parse import urlparse\nif urlparse(marketplace_url).scheme != \"https\":\n    raise ValueError(\"Marketplace URL must be https\")","typeGuard":"def is_https_url(url: str) -> bool:\n    return urlparse(url).scheme == \"https\"","tryCatchPattern":"try:\n    marketplace, path = materialize_marketplace_source(source)\nexcept MarketplaceError as exc:\n    if \"redirect must use https\" in str(exc):\n        log.warning(\"Marketplace host redirects to non-https; fix server or pick another URL\")\n    else:\n        raise","preventionTips":["Always register marketplaces with https:// URLs","Check redirect chains with curl -sIL before adding a marketplace","Prefer well-known hosts with enforced HTTPS"],"tags":["network","security","https","redirect"],"backgroundTag":"insecure-redirect-downgrade","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}