tonhowtf/omniget · error

escolha o zip do export do Reddit ou a pasta onde ele foi…

Error message

escolha o zip do export do Reddit ou a pasta onde ele foi descompactado

What it means

read_source() accepts either a directory of extracted CSVs or a .zip archive; the given path was neither, so it is rejected before any I/O. The message tells the user to supply the Reddit export zip or the unzipped folder.

Solutions

  1. Pass the original GDPR export .zip file as the path
  2. Or extract it and pass the resulting directory
  3. Do not pass individual CSVs or other archive formats — repackage as zip if needed

Example fix

// before
path: "export/data.csv"
// after
path: "reddit_data_request_export.zip"
Defensive patterns

Strategy: validation

Validate before calling

fn looks_like_export_input(path: &str) -> bool {
    let p = std::path::Path::new(path);
    p.is_dir() || path.to_ascii_lowercase().ends_with(".zip")
}
// assert!(looks_like_export_input(&opts.path));

Prevention

When it happens

Trigger: run() called with a path whose lowercased string does not end with '.zip' and which is not the directory case handled earlier (e.g. a single .csv file, a .tar.gz, or a missing extension).

Common situations: Passing an individual CSV instead of the export root; passing a .tar.gz or .7z export; a directory path with a trailing oddity; pointing at the downloaded but differently-formatted data request file.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/reddit/gdpr.rs:256

            .flatten()
        {
            let p = entry.path();
            if p.is_file() && is_csv(&p.to_string_lossy()) {
                if let Ok(text) = read_text(p) {
                    out.insert(short_name(&p.to_string_lossy()), text);
                }
            }
        }
        if out.is_empty() {
            return Err(anyhow!(
                "nenhum .csv nesta pasta — aponte para a pasta do export ou para o zip"
            ));
        }
        return Ok(out);
    }
    let lower = path.to_string_lossy().to_ascii_lowercase();
    if !lower.ends_with(".zip") {
        return Err(anyhow!(
            "escolha o zip do export do Reddit ou a pasta onde ele foi descompactado"
        ));
    }
    let file = std::fs::File::open(path)?;
    let mut zip =
        zip::ZipArchive::new(file).map_err(|e| anyhow!("não foi possível abrir o zip: {}", e))?;
    for i in 0..zip.len() {
        let mut entry = match zip.by_index(i) {
            Ok(e) => e,
            Err(_) => continue,
        };
        if !entry.is_file() || !is_csv(entry.name()) {
            continue;
        }
        let name = short_name(entry.name());
        let mut buf = Vec::new();
        if entry.read_to_end(&mut buf).is_ok() {
            out.insert(name, String::from_utf8_lossy(&buf).to_string());

View on GitHub (pinned to 8600b91f42)