tonhowtf/omniget · error

não achei

Error message

não achei {}

What it means

GDPR export tool for Reddit archives validates that the user-supplied path exists before reading it. If `opts.path` does not resolve to an existing file or directory on disk, `run` aborts immediately with this Portuguese message via anyhow!. It is an up-front guard so the tool fails fast instead of erroring deeper in `read_source`.

Solutions

  1. Check that the path exists before calling: `Path::new(&opts.path).exists()`
  2. Pass an absolute path instead of a relative one
  3. Verify the working directory of the process matches the assumption of the relative path
  4. Confirm the user actually downloaded/extracted the Reddit GDPR export to that location

Example fix

// before
let opts = Options { path: "~/Downloads/reddit".into(), .. };
run(&opts, progress)?;
// after
let expanded = shellexpand::tilde("~/Downloads/reddit").to_string();
assert!(Path::new(&expanded).exists(), "GDPR path missing: {expanded}");
let opts = Options { path: expanded, .. };
run(&opts, progress)?;
Defensive patterns

Strategy: validation

Validate before calling

let p = PathBuf::from(&opts.path);
if !p.exists() {
    return Err(format!("GDPR path does not exist: {}", opts.path));
}
if !p.is_dir() {
    return Err(format!("GDPR path is not a directory: {}", opts.path));
}

Type guard

fn gdpr_path_is_valid(s: &str) -> bool {
    let p = PathBuf::from(s);
    p.exists() && (p.is_dir() || p.extension().map_or(false, |e| e == "zip"))
}

Try / catch

match run(&opts, &progress) {
    Ok(res) => println!("exported to {}", res.zip_path),
    Err(e) if e.to_string().starts_with("não achei") => {
        eprintln!("Path not found: {} — check the folder exists", opts.path);
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `run(&Options{ path: ... }, progress)` where the path string points to a non-existent file/directory, contains a typo, uses a wrong relative path (wrong working directory), or the folder was moved/deleted before the call.

Common situations: User pasted a path with a trailing typo or spaces; ran the binary from a different CWD so a relative path no longer resolves; the GDPR ZIP downloaded from Reddit was renamed or deleted; path uses Windows backslashes in an unescaped Rust string.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

#[derive(Debug, Clone, Deserialize)]
pub struct Options {
    /// O zip do export ou a pasta onde ele foi descompactado.
    pub path: String,
    /// Quando vem preenchido, grava o resumo aqui.
    #[serde(default)]
    pub export_dir: Option<String>,
    /// "json", "csv", "md".
    #[serde(default)]
    pub formats: Vec<String>,
    #[serde(default = "def_top")]
    pub top: usize,
}

pub fn run(opts: &Options, progress: &ProgressFn) -> Result<GdprResult> {
    report(progress, ID, "started", 0, None, None);
    let path = PathBuf::from(&opts.path);
    if !path.exists() {
        return Err(anyhow!("não achei {}", opts.path));
    }
    let files = read_source(&path)?;
    report(
        progress,
        ID,
        "progress",
        files.len() as u64,
        Some(files.len() as u64),
        Some(format!("{} arquivos", files.len())),
    );
    let mut result = summarize(&files, &opts.path, opts.top);
    if let Some(dir) = opts.export_dir.as_ref().filter(|d| !d.trim().is_empty()) {
        let formats = if opts.formats.is_empty() {
            vec!["json".to_string(), "md".to_string()]
        } else {
            opts.formats.clone()
        };
        result.exported = export(&result, Path::new(dir), &formats)?;

View on GitHub (pinned to 8600b91f42)