tonhowtf/omniget · error · anyhow::Error

nao foi possivel consultar releases de

Error message

nao foi possivel consultar releases de {}: HTTP {}

What it means

`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.

Solutions

  1. Check the HTTP status in the message: 403/429 means rate limiting — add a GitHub token or wait before retrying
  2. Verify the repo path (e.g. `spicetify/spicetify-cli`) exists and is spelled correctly
  3. Check network connectivity / proxy configuration for api.github.com
  4. Retry later if GitHub status (githubstatus.com) reports an incident
  5. Retry with exponential backoff for transient 5xx responses

Example fix

// before
let asset = latest_asset(&client, "spicetify/spicetify-cli", pick).await?;
// after
match latest_asset(&client, "spicetify/spicetify-cli", pick).await {
    Ok(a) => a,
    Err(e) if e.to_string().contains("429") => { sleep(Duration::from_secs(60)).await; latest_asset(&client, "spicetify/spicetify-cli", pick).await? }
    Err(e) => return Err(e),
}
Defensive patterns

Strategy: retry

Validate before calling

let resp = client.head(format!("https://api.github.com/repos/{repo}")).send().await?;
if !resp.status().is_success() { eprintln!("repo unreachable: {}", resp.status()); }

Try / catch

match latest_asset(&client, repo, pick).await {
    Err(e) if e.to_string().contains("HTTP 403") || e.to_string().contains("HTTP 429") => {
        wait_for_rate_limit_reset().await;
        latest_asset(&client, repo, pick).await
    }
    other => other,
}

Prevention

When it happens

Trigger: `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.

Common situations: Anonymous GitHub API rate limit exceeded (60 req/hour per IP); repo renamed or deleted; corporate proxy blocking api.github.com; offline environment.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/83f4f766ceb91e75. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/spicetify.rs:382

struct ReleaseAsset {
    tag: String,
    name: String,
    url: String,
    digest: Option<String>,
}

/// Asset do último release cujo nome termina com `suffix`, com o `digest`
/// que a API do GitHub publica.
async fn latest_asset(
    client: &reqwest::Client,
    repo: &str,
    pick: impl Fn(&str) -> bool,
) -> anyhow::Result<ReleaseAsset> {
    let url = format!("https://api.github.com/repos/{}/releases/latest", repo);
    let response = client.get(&url).send().await?;
    if !response.status().is_success() {
        return Err(anyhow!(
            "nao foi possivel consultar releases de {}: HTTP {}",
            repo,
            response.status()
        ));
    }
    let json: serde_json::Value = response.json().await?;
    let tag = json["tag_name"].as_str().unwrap_or("").to_string();
    let assets = json["assets"]
        .as_array()
        .ok_or_else(|| anyhow!("release de {} sem assets", repo))?;
    for asset in assets {
        let name = asset["name"].as_str().unwrap_or("");
        if pick(name) {
            return Ok(ReleaseAsset {
                tag: tag.clone(),
                name: name.to_string(),
                url: asset["browser_download_url"]
                    .as_str()

View on GitHub (pinned to 8600b91f42)