FuelLabs/sway · error · anyhow::Error

Failed to fetch {pkg_name}

Error message

Failed to fetch {pkg_name}

What it means

Error "Failed to fetch {pkg_name}" thrown in FuelLabs/sway.

Source

Thrown at forc-pkg/src/source/reg/mod.rs:641

    let index_repo_name = github_resolver.repo_name();
    let reference = format!("refs/heads/{}", github_resolver.branch_name());
    let github_endpoint = format!(
        "https://raw.githubusercontent.com/{index_repo_owner}/{index_repo_name}/{reference}/{path}"
    );
    let client = reqwest::Client::new();
    let timeout_duration = Duration::from_millis(GithubRegistryResolver::DEFAULT_TIMEOUT_MS);
    let index_response = client
        .get(github_endpoint)
        .timeout(timeout_duration)
        .send()
        .await
        .map_err(|e| {
            anyhow!(
                "Failed to send request to github to obtain package index file from registry {e}"
            )
        })?
        .error_for_status()
        .map_err(|_| anyhow!("Failed to fetch {pkg_name}"))?;

    let contents = index_response.text().await?;
    let index_file: IndexFile = serde_json::from_str(&contents).with_context(|| {
        format!("Unable to deserialize a github registry lookup response. Body was: \"{contents}\"")
    })?;

    let res = f(index_file).await?;
    Ok(res)
}

/// Execute an async block on a Tokio runtime.
///
/// If we are already in a runtime, this will spawn a new OS thread to create a new runtime.
///
/// If we are not in a runtime, a new runtime is created and the future is blocked on.
pub(crate) fn block_on_any_runtime<F>(future: F) -> F::Output
where
    F: std::future::Future + Send + 'static,

View on GitHub (pinned to 47e5e902fa)

When it happens

Trigger: Thrown at forc-pkg/src/source/reg/mod.rs:641 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of FuelLabs/sway@47e5e902fa (2026-08-16). Data as JSON: /api/errors/a41e2dd0673eb594. Report an issue: GitHub.