{"record":{"id":"a41e2dd0673eb594","repo":"FuelLabs/sway","slug":"failed-to-fetch-pkg-name","errorCode":null,"errorMessage":"Failed to fetch {pkg_name}","messagePattern":"Failed to fetch (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-pkg/src/source/reg/mod.rs","lineNumber":641,"sourceCode":"    let index_repo_name = github_resolver.repo_name();\n    let reference = format!(\"refs/heads/{}\", github_resolver.branch_name());\n    let github_endpoint = format!(\n        \"https://raw.githubusercontent.com/{index_repo_owner}/{index_repo_name}/{reference}/{path}\"\n    );\n    let client = reqwest::Client::new();\n    let timeout_duration = Duration::from_millis(GithubRegistryResolver::DEFAULT_TIMEOUT_MS);\n    let index_response = client\n        .get(github_endpoint)\n        .timeout(timeout_duration)\n        .send()\n        .await\n        .map_err(|e| {\n            anyhow!(\n                \"Failed to send request to github to obtain package index file from registry {e}\"\n            )\n        })?\n        .error_for_status()\n        .map_err(|_| anyhow!(\"Failed to fetch {pkg_name}\"))?;\n\n    let contents = index_response.text().await?;\n    let index_file: IndexFile = serde_json::from_str(&contents).with_context(|| {\n        format!(\"Unable to deserialize a github registry lookup response. Body was: \\\"{contents}\\\"\")\n    })?;\n\n    let res = f(index_file).await?;\n    Ok(res)\n}\n\n/// Execute an async block on a Tokio runtime.\n///\n/// If we are already in a runtime, this will spawn a new OS thread to create a new runtime.\n///\n/// If we are not in a runtime, a new runtime is created and the future is blocked on.\npub(crate) fn block_on_any_runtime<F>(future: F) -> F::Output\nwhere\n    F: std::future::Future + Send + 'static,","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-pkg/src/source/reg/mod.rs#L623-L659","documentation":"Error \"Failed to fetch {pkg_name}\" thrown in FuelLabs/sway.","triggerScenarios":"Thrown at forc-pkg/src/source/reg/mod.rs:641 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}