{"record":{"id":"c3c3ad18b5450c45","repo":"tonhowtf/omniget","slug":"formato-nao-disponivel-para","errorCode":null,"errorMessage":"formato {} nao disponivel para {}","messagePattern":"formato (.+?) nao disponivel para (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/gdocs.rs","lineNumber":65,"sourceCode":"        return urlencoding::decode(&s[..end]).ok().map(|c| c.to_string());\n    }\n    let i = v.find(\"filename=\")?;\n    let s = v[i + 9..].trim().trim_matches('\"');\n    let end = s.find(';').unwrap_or(s.len());\n    Some(s[..end].trim_matches('\"').to_string())\n}\n\npub async fn download(\n    url: &str,\n    format: &str,\n    dest_dir: &str,\n    progress: super::ProgressFn,\n) -> anyhow::Result<String> {\n    let info = parse(url).ok_or_else(|| {\n        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()","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/gdocs.rs#L47-L83","documentation":"download() in gdocs.rs exports a Google Docs/Sheets/Slides file via the export URL. Before building the request it checks that the requested format (e.g. pdf, docx, xlsx, zip) is one of the formats valid for the parsed document kind. If not, it fails immediately with this message naming the format and the document kind.","triggerScenarios":"Calling download(url, format) where format is not in info.formats for the document kind parsed from the URL, e.g. requesting 'xlsx' for a Google Document or 'docx' for a Spreadsheet.","commonSituations":"Hardcoded export format strings that assume the link is a Document when the user pastes a Sheets or Slides link; typos in format names ('PDF' vs 'pdf'); UI dropdowns not filtered per document kind.","solutions":["Check info.kind and pass a format valid for that kind (Documents: pdf/docx/odt/txt/html; Sheets: xlsx/ods/csv/pdf; Slides: pdf/pptx/odp)","Parse the URL first with parse() to inspect info.formats before choosing a format","Fix the format string spelling/case used at the call site"],"exampleFix":"// before\ndownload(url, \"docx\")?; // url is a Google Sheet\n// after\nlet info = gdocs::parse(url).unwrap();\nlet fmt = if info.formats.contains(&\"docx\".to_string()) { \"docx\" } else { \"pdf\" };\ndownload(url, fmt).await?;","handlingStrategy":"validation","validationCode":"let info = gdocs::parse(url).context(\"URL invalida do Google Docs\")?;\nif !info.formats.iter().any(|f| f == format) {\n    return Err(format!(\"formato {} nao disponivel para {:?}; use um de {:?}\", format, info.kind, info.formats));\n}","typeGuard":"fn format_supported(info: &DocInfo, format: &str) -> bool {\n    info.formats.iter().any(|f| f == format)\n}","tryCatchPattern":null,"preventionTips":["Parse the URL and read info.formats before choosing an export format","Drive the format list from the UI dropdown instead of free-text input","Normalize format strings to lowercase and trim whitespace"],"tags":["gdocs","invalid-argument-value","export-format"],"backgroundTag":"invalid-argument-value","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"}