tonhowtf/omniget · error

Google Docs: HTTP

Error message

Google Docs: HTTP {}

What it means

download() treats any export HTTP status other than success (and outside the already-handled 401/403) as a failure, surfacing the status code verbatim. This is the generic network/HTTP failure path of the Google Docs exporter.

Solutions

  1. Check the printed HTTP status: 404 means the document ID is wrong or the file was deleted; verify the URL opens in an incognito browser
  2. Retry after a delay on 429/5xx transient statuses
  3. Confirm the URL is a valid docs.google.com document link
Defensive patterns

Strategy: retry

Validate before calling

// sanity-check the URL before calling
if !url.starts_with("https://docs.google.com/") { return Err("URL nao e do Google Docs"); }

Try / catch

for attempt in 0..3 {
    match gdocs::download(&url, format).await {
        Ok(p) => { return Ok(p); }
        Err(e) if e.to_string().contains("HTTP 429") || e.to_string().contains("HTTP 5") => {
            tokio::time::sleep(Duration::from_secs(2u64 << attempt)).await;
        }
        Err(e) => return Err(e),
    }
}

Prevention

When it happens

Trigger: Google's export endpoint returns 4xx/5xx other than 401/403: 404 for a deleted or mistyped document ID, 429 rate limiting, 5xx from Google, or redirects to a login page with an unexpected status.

Common situations: Malformed document ID in the pasted URL; file moved to trash; transient Google server errors; heavy export usage triggering throttling.

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/9c24b24467857068. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/gdocs.rs:80

        anyhow!("cole um link de docs.google.com (Documentos, Apresentações ou Planilhas)")
    })?;
    if !info.formats.iter().any(|f| f == format) {
        return Err(anyhow!(
            "formato {} nao disponivel para {}",
            format,
            info.kind
        ));
    }
    let client = super::client()?;
    let export = export_url(&info, format);
    let resp = client.get(&export).send().await?;
    if resp.status().as_u16() == 401 || resp.status().as_u16() == 403 {
        return Err(anyhow!(
            "o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download"
        ));
    }
    if !resp.status().is_success() {
        return Err(anyhow!("Google Docs: HTTP {}", resp.status()));
    }
    let name = resp
        .headers()
        .get(reqwest::header::CONTENT_DISPOSITION)
        .and_then(|v| v.to_str().ok())
        .and_then(filename_from_disposition)
        .unwrap_or_else(|| format!("{}.{}", info.id, format));
    let dir = PathBuf::from(dest_dir);
    std::fs::create_dir_all(&dir)?;
    let dest = dir.join(super::sanitize_name(&name));
    let bytes = resp.bytes().await?;
    tokio::fs::write(&dest, &bytes).await?;
    super::report(
        &progress,
        "gdocs",
        "done",
        bytes.len() as u64,
        Some(bytes.len() as u64),

View on GitHub (pinned to 8600b91f42)