{"record":{"id":"83f4f766ceb91e75","repo":"tonhowtf/omniget","slug":"nao-foi-possivel-consultar-releases-de-http","errorCode":null,"errorMessage":"nao foi possivel consultar releases de {}: HTTP {}","messagePattern":"nao foi possivel consultar releases de (.+?): HTTP (.+?)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/spicetify.rs","lineNumber":382,"sourceCode":"\nstruct ReleaseAsset {\n    tag: String,\n    name: String,\n    url: String,\n    digest: Option<String>,\n}\n\n/// Asset do último release cujo nome termina com `suffix`, com o `digest`\n/// que a API do GitHub publica.\nasync fn latest_asset(\n    client: &reqwest::Client,\n    repo: &str,\n    pick: impl Fn(&str) -> bool,\n) -> anyhow::Result<ReleaseAsset> {\n    let url = format!(\"https://api.github.com/repos/{}/releases/latest\", repo);\n    let response = client.get(&url).send().await?;\n    if !response.status().is_success() {\n        return Err(anyhow!(\n            \"nao foi possivel consultar releases de {}: HTTP {}\",\n            repo,\n            response.status()\n        ));\n    }\n    let json: serde_json::Value = response.json().await?;\n    let tag = json[\"tag_name\"].as_str().unwrap_or(\"\").to_string();\n    let assets = json[\"assets\"]\n        .as_array()\n        .ok_or_else(|| anyhow!(\"release de {} sem assets\", repo))?;\n    for asset in assets {\n        let name = asset[\"name\"].as_str().unwrap_or(\"\");\n        if pick(name) {\n            return Ok(ReleaseAsset {\n                tag: tag.clone(),\n                name: name.to_string(),\n                url: asset[\"browser_download_url\"]\n                    .as_str()","sourceCodeStart":364,"sourceCodeEnd":400,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/spicetify.rs#L364-L400","documentation":"`latest_asset` queries the GitHub API `repos/{repo}/releases/latest` to find the newest release asset. If the HTTP response status is not a success (e.g. 403 rate-limited, 404 repo missing, 5xx), it fails with this error naming the repo and the status code. It is a fail-fast guard before JSON parsing.","triggerScenarios":"`latest_asset(client, repo, pick)` where GitHub returns a non-2xx: repo doesn't exist, rate limit (403) with no token, network proxies returning errors, GitHub outage.","commonSituations":"Anonymous GitHub API rate limit exceeded (60 req/hour per IP); repo renamed or deleted; corporate proxy blocking api.github.com; offline environment.","solutions":["Check the HTTP status in the message: 403/429 means rate limiting — add a GitHub token or wait before retrying","Verify the repo path (e.g. `spicetify/spicetify-cli`) exists and is spelled correctly","Check network connectivity / proxy configuration for api.github.com","Retry later if GitHub status (githubstatus.com) reports an incident","Retry with exponential backoff for transient 5xx responses"],"exampleFix":"// before\nlet asset = latest_asset(&client, \"spicetify/spicetify-cli\", pick).await?;\n// after\nmatch latest_asset(&client, \"spicetify/spicetify-cli\", pick).await {\n    Ok(a) => a,\n    Err(e) if e.to_string().contains(\"429\") => { sleep(Duration::from_secs(60)).await; latest_asset(&client, \"spicetify/spicetify-cli\", pick).await? }\n    Err(e) => return Err(e),\n}","handlingStrategy":"retry","validationCode":"let resp = client.head(format!(\"https://api.github.com/repos/{repo}\")).send().await?;\nif !resp.status().is_success() { eprintln!(\"repo unreachable: {}\", resp.status()); }","typeGuard":null,"tryCatchPattern":"match latest_asset(&client, repo, pick).await {\n    Err(e) if e.to_string().contains(\"HTTP 403\") || e.to_string().contains(\"HTTP 429\") => {\n        wait_for_rate_limit_reset().await;\n        latest_asset(&client, repo, pick).await\n    }\n    other => other,\n}","preventionTips":["Use an authenticated GitHub client (`github_client()` with a token) to raise rate limits","Cache the latest release result instead of polling the API each run","Check GitHub status before assuming the repo is broken on 5xx","Retry transient failures with exponential backoff"],"tags":["network","github-api","http"],"backgroundTag":"http-error-response","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}