ansible/ansible · error · AnsibleError

Downloading {url} failed

Error message

Downloading {url} failed

What it means

Error "Downloading {url} failed" thrown in ansible/ansible.

Source

Thrown at lib/ansible/galaxy/collection/concrete_artifact_manager.py:516

    b_file_path = os.path.join(b_tarball_dir, b_tarball_name)

    display.display("Downloading %s to %s" % (url, to_text(b_tarball_dir)))
    # NOTE: Galaxy redirects downloads to S3 which rejects the request
    # NOTE: if an Authorization header is attached so don't redirect it
    resp = open_url(
        to_native(url, errors='surrogate_or_strict'),
        validate_certs=validate_certs,
        headers=None if token is None else token.headers(),
        unredirected_headers=['Authorization'], http_agent=user_agent(),
        timeout=timeout
    )

    with open(b_file_path, 'wb') as download_file:  # type: t.BinaryIO
        try:
            actual_hash = _consume_file(resp, write_to=download_file)
        except IncompleteRead as orig_exc:
            raise AnsibleError(f"Downloading {url} failed") from orig_exc

    if expected_hash:
        display.vvvv(
            'Validating downloaded file hash {actual_hash!s} with '
            'expected hash {expected_hash!s}'.
            format(actual_hash=actual_hash, expected_hash=expected_hash)
        )
        if expected_hash != actual_hash:
            raise AnsibleError('Mismatch artifact hash with downloaded file')

    return b_file_path


def _consume_file(read_from: t.BinaryIO | HTTPResponse, write_to: t.BinaryIO | None = None) -> str:
    bufsize = 65536
    sha256_digest = sha256()
    length = getattr(read_from, 'length', None)
    actual_length = 0

View on GitHub (pinned to 9cf16a4aca)

Solutions

  1. Check network connectivity and the URL.
  2. Verify any required authentication tokens are configured.
  3. Retry the download or use a local tarball.

When it happens

Trigger: Thrown at lib/ansible/galaxy/collection/concrete_artifact_manager.py:516 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ansible/ansible@9cf16a4aca (2026-08-15). Data as JSON: /api/errors/dedec0d680bee340. Report an issue: GitHub.