{"record":{"id":"2e942fd175e1fcd5","repo":"tonhowtf/omniget","slug":"este-zip-n-o-tem-nenhum-csv-do-export-do-reddit","errorCode":null,"errorMessage":"este zip não tem nenhum .csv do export do Reddit","messagePattern":"este zip não tem nenhum \\.csv do export do Reddit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/gdpr.rs","lineNumber":278,"sourceCode":"    let file = std::fs::File::open(path)?;\n    let mut zip =\n        zip::ZipArchive::new(file).map_err(|e| anyhow!(\"não foi possível abrir o zip: {}\", e))?;\n    for i in 0..zip.len() {\n        let mut entry = match zip.by_index(i) {\n            Ok(e) => e,\n            Err(_) => continue,\n        };\n        if !entry.is_file() || !is_csv(entry.name()) {\n            continue;\n        }\n        let name = short_name(entry.name());\n        let mut buf = Vec::new();\n        if entry.read_to_end(&mut buf).is_ok() {\n            out.insert(name, String::from_utf8_lossy(&buf).to_string());\n        }\n    }\n    if out.is_empty() {\n        return Err(anyhow!(\"este zip não tem nenhum .csv do export do Reddit\"));\n    }\n    Ok(out)\n}\n\nfn read_text(path: &Path) -> Result<String> {\n    let bytes = std::fs::read(path)?;\n    Ok(String::from_utf8_lossy(&bytes).to_string())\n}\n\n// ───────────────────────── resumo ─────────────────────────\n\nfn pick<'a>(files: &'a HashMap<String, String>, stem: &str) -> Option<&'a String> {\n    files.get(&format!(\"{}.csv\", stem)).or_else(|| {\n        files\n            .iter()\n            .find(|(k, _)| k.starts_with(stem))\n            .map(|(_, v)| v)\n    })","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/gdpr.rs#L260-L296","documentation":"The zip opened successfully, but iterating its entries found no file whose name passes is_csv (Reddit export CSVs). Entries that fail to read are skipped silently, and if nothing CSV-shaped was collected the library throws this error.","triggerScenarios":"A valid .zip that contains no .csv entries (or only unreadable ones) was passed to run().","commonSituations":"Selecting the wrong zip (e.g. another tool's archive); a Reddit export variant that ships .zst-compressed CSVs instead of .csv; a zip whose CSVs sit in nested formats with unexpected extensions; partially extracted/repacked archive.","solutions":["Verify you are passing Reddit's own GDPR data-request zip (it contains comments.csv, posts.csv, etc.)","Inspect contents: `unzip -l export.zip | grep -i csv`","If the new export format uses .zst CSVs, decompress them to .csv first or point at a folder of extracted CSVs","Re-export your data from Reddit if the archive is genuinely missing CSVs"],"exampleFix":"// before\npath: \"photos-backup.zip\"  // no csv inside\n// after\npath: \"reddit_data_request_export.zip\"  // contains comments.csv, posts.csv, ...","handlingStrategy":"validation","validationCode":"fn zip_has_csv(path: &str) -> std::io::Result<bool> {\n    let f = std::fs::File::open(path)?;\n    let mut z = zip::ZipArchive::new(f).map_err(std::io::Error::other)?;\n    for i in 0..z.len() {\n        if z.by_index(i)?.name().to_ascii_lowercase().ends_with(\".csv\") { return Ok(true); }\n    }\n    Ok(false)\n}\n// assert!(zip_has_csv(\"export.zip\")?);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm with `unzip -l export.zip | grep -i csv` that CSVs exist before running","Use Reddit's own GDPR export zip, not other archives","If the export ships .zst CSVs, decompress them to .csv first or pass the extracted folder"],"tags":["reddit","gdpr-export","csv","empty-archive"],"backgroundTag":"empty-result-set","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"}