{"record":{"id":"9c24b24467857068","repo":"tonhowtf/omniget","slug":"google-docs-http","errorCode":null,"errorMessage":"Google Docs: HTTP {}","messagePattern":"Google Docs: HTTP (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/gdocs.rs","lineNumber":80,"sourceCode":"        anyhow!(\"cole um link de docs.google.com (Documentos, Apresentações ou Planilhas)\")\n    })?;\n    if !info.formats.iter().any(|f| f == format) {\n        return Err(anyhow!(\n            \"formato {} nao disponivel para {}\",\n            format,\n            info.kind\n        ));\n    }\n    let client = super::client()?;\n    let export = export_url(&info, format);\n    let resp = client.get(&export).send().await?;\n    if resp.status().as_u16() == 401 || resp.status().as_u16() == 403 {\n        return Err(anyhow!(\n            \"o arquivo nao e publico; abra no navegador e use Arquivo > Fazer download\"\n        ));\n    }\n    if !resp.status().is_success() {\n        return Err(anyhow!(\"Google Docs: HTTP {}\", resp.status()));\n    }\n    let name = resp\n        .headers()\n        .get(reqwest::header::CONTENT_DISPOSITION)\n        .and_then(|v| v.to_str().ok())\n        .and_then(filename_from_disposition)\n        .unwrap_or_else(|| format!(\"{}.{}\", info.id, format));\n    let dir = PathBuf::from(dest_dir);\n    std::fs::create_dir_all(&dir)?;\n    let dest = dir.join(super::sanitize_name(&name));\n    let bytes = resp.bytes().await?;\n    tokio::fs::write(&dest, &bytes).await?;\n    super::report(\n        &progress,\n        \"gdocs\",\n        \"done\",\n        bytes.len() as u64,\n        Some(bytes.len() as u64),","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/gdocs.rs#L62-L98","documentation":"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.","triggerScenarios":"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.","commonSituations":"Malformed document ID in the pasted URL; file moved to trash; transient Google server errors; heavy export usage triggering throttling.","solutions":["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","Retry after a delay on 429/5xx transient statuses","Confirm the URL is a valid docs.google.com document link"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// sanity-check the URL before calling\nif !url.starts_with(\"https://docs.google.com/\") { return Err(\"URL nao e do Google Docs\"); }","typeGuard":null,"tryCatchPattern":"for attempt in 0..3 {\n    match gdocs::download(&url, format).await {\n        Ok(p) => { return Ok(p); }\n        Err(e) if e.to_string().contains(\"HTTP 429\") || e.to_string().contains(\"HTTP 5\") => {\n            tokio::time::sleep(Duration::from_secs(2u64 << attempt)).await;\n        }\n        Err(e) => return Err(e),\n    }\n}","preventionTips":["Retry with backoff on 429/5xx statuses","Validate the document URL opens in an incognito browser before calling the API","Log the exact HTTP status from the message to distinguish 404 (bad ID) from 5xx (transient)"],"tags":["gdocs","http-error","network"],"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"}