{"record":{"id":"dedec0d680bee340","repo":"ansible/ansible","slug":"downloading-url-failed","errorCode":null,"errorMessage":"Downloading {url} failed","messagePattern":"Downloading (.+?) failed","errorType":"exception","errorClass":"AnsibleError","httpStatus":null,"severity":"error","filePath":"lib/ansible/galaxy/collection/concrete_artifact_manager.py","lineNumber":516,"sourceCode":"\n    b_file_path = os.path.join(b_tarball_dir, b_tarball_name)\n\n    display.display(\"Downloading %s to %s\" % (url, to_text(b_tarball_dir)))\n    # NOTE: Galaxy redirects downloads to S3 which rejects the request\n    # NOTE: if an Authorization header is attached so don't redirect it\n    resp = open_url(\n        to_native(url, errors='surrogate_or_strict'),\n        validate_certs=validate_certs,\n        headers=None if token is None else token.headers(),\n        unredirected_headers=['Authorization'], http_agent=user_agent(),\n        timeout=timeout\n    )\n\n    with open(b_file_path, 'wb') as download_file:  # type: t.BinaryIO\n        try:\n            actual_hash = _consume_file(resp, write_to=download_file)\n        except IncompleteRead as orig_exc:\n            raise AnsibleError(f\"Downloading {url} failed\") from orig_exc\n\n    if expected_hash:\n        display.vvvv(\n            'Validating downloaded file hash {actual_hash!s} with '\n            'expected hash {expected_hash!s}'.\n            format(actual_hash=actual_hash, expected_hash=expected_hash)\n        )\n        if expected_hash != actual_hash:\n            raise AnsibleError('Mismatch artifact hash with downloaded file')\n\n    return b_file_path\n\n\ndef _consume_file(read_from: t.BinaryIO | HTTPResponse, write_to: t.BinaryIO | None = None) -> str:\n    bufsize = 65536\n    sha256_digest = sha256()\n    length = getattr(read_from, 'length', None)\n    actual_length = 0","sourceCodeStart":498,"sourceCodeEnd":534,"githubUrl":"https://github.com/ansible/ansible/blob/9cf16a4aca7898481c257f1e17ad28d0b67b1f85/lib/ansible/galaxy/collection/concrete_artifact_manager.py#L498-L534","documentation":"Error \"Downloading {url} failed\" thrown in ansible/ansible.","triggerScenarios":"Thrown at lib/ansible/galaxy/collection/concrete_artifact_manager.py:516 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check network connectivity and the URL.","Verify any required authentication tokens are configured.","Retry the download or use a local tarball."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9cf16a4aca7898481c257f1e17ad28d0b67b1f85","analyzedAt":"2026-08-15T00:15:47.100Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}