tonhowtf/omniget · error

pasta de origem não encontrada

Error message

pasta de origem não encontrada: {}

What it means

Thrown by SwitchAlbum's `run` when the configured source path (`opts.source`) does not exist as a directory on disk. The tool refuses to start scanning a non-existent source folder instead of silently returning zero files, so the user gets an explicit Portuguese message including the path checked.

Solutions

  1. Check the exact path printed in the message with `ls` (or Explorer) and fix the typo in the source field
  2. Point `source` at the album directory (e.g. the SD card's Nintendo/Album root), not a file
  3. Re-insert/mount the SD card or drive and retry
  4. Verify the frontend actually passes a non-empty `source` string to the command

Example fix

// before
run(SwitchOptions { source: "/run/media/user/CARD/Nintendo/Album ", .. })
// after
run(SwitchOptions { source: "/run/media/user/CARD/Nintendo/Album", .. })  // trimmed, exists, is a dir
Defensive patterns

Strategy: validation

Validate before calling

if !std::path::Path::new(source.trim()).is_dir() {
    return Err(format!("source folder does not exist or is not a directory: {}", source));
}

Type guard

fn is_valid_source_dir(p: &str) -> bool {
    std::path::Path::new(p.trim()).is_dir()
}

Try / catch

match switch_album::run(opts, progress).await {
    Ok(result) => handle(result),
    Err(e) if e.to_string().contains("pasta de origem") => prompt_user_for_valid_source(),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling `run(SwitchOptions { source: <path>, .. })` where `PathBuf::from(opts.source.trim()).is_dir()` is false — the path doesn't exist, is a file instead of a directory, or the string is empty/whitespace.

Common situations: User typo'd the SD card mount path; the SD card (e.g. /run/media/user/CARD) was unplugged before the transfer; path points to a single screenshot file rather than the album root; forward/back slash confusion when passing Windows paths into the Tauri backend.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/games/switch_album.rs:259

            "-c:a",
            "libopus",
            "-b:a",
            "96k",
        ])
        .arg(&output)
        .output()
        .await
        .map_err(|e| anyhow::anyhow!("ffmpeg nao iniciou: {}", e))?;
    if !out.status.success() {
        anyhow::bail!("{}", String::from_utf8_lossy(&out.stderr).trim());
    }
    Ok(output)
}

pub async fn run(opts: SwitchOptions, progress: ProgressFn) -> anyhow::Result<SwitchResult> {
    let source = PathBuf::from(opts.source.trim());
    if !source.is_dir() {
        anyhow::bail!("pasta de origem não encontrada: {}", source.display());
    }
    let dest_root = PathBuf::from(opts.dest.trim());
    if opts.dest.trim().is_empty() {
        anyhow::bail!("escolha a pasta da biblioteca de destino");
    }
    let move_it = opts.mode == "move";

    report(&progress, ID, "progress", 0, None, None);
    let found = collect(&source, &opts.kinds);
    let total = found.len() as u64;
    if total == 0 {
        report(&progress, ID, "done", 0, Some(0), None);
        return Ok(SwitchResult {
            items: Vec::new(),
            games: Vec::new(),
            found: 0,
            imported: 0,
            skipped: 0,

View on GitHub (pinned to 8600b91f42)