tonhowtf/omniget · error

escolha a pasta de destino para organizar

Error message

escolha a pasta de destino para organizar

What it means

This error is thrown by clip_organizer::run when the user requested an organizing mode ('copy' or 'move') but provided an empty `dest` path. Without a destination folder the organizer has nowhere to place the reorganized clips, so it fails fast via anyhow::bail before scanning any files. The message is in Portuguese: 'choose the destination folder to organize'.

Solutions

  1. Set opts.dest to a valid existing (or creatable) directory path before calling run
  2. Set opts.mode to 'scan' (any value other than copy/move) if you only want scanning without organizing
  3. Validate dest in the UI/CLI before invoking run, requiring a non-empty trimmed path

Example fix

// before
let opts = ClipOrganizerOptions { mode: "move".into(), dest: "".into(), .. };
run(opts, progress).await?;
// after
let opts = ClipOrganizerOptions { mode: "move".into(), dest: "/home/user/Videos/organized".into(), .. };
run(opts, progress).await?;
Defensive patterns

Strategy: validation

Validate before calling

if opts.mode == "copy" || opts.mode == "move" {
    if opts.dest.trim().is_empty() {
        return Err(anyhow::anyhow!("dest is required when mode is copy/move"));
    }
}

Type guard

fn has_dest_for_organizing(opts: &ClipOrganizerOptions) -> bool {
    let organizing = opts.mode == "copy" || opts.mode == "move";
    !organizing || !opts.dest.trim().is_empty()
}

Try / catch

match run(opts, progress).await {
    Ok(result) => handle(result),
    Err(e) if e.to_string().contains("pasta de destino") => prompt_user_for_destination(),
    Err(e) => eprintln!("organizer failed: {e}"),
}

Prevention

When it happens

Trigger: Calling run (directly or via scan_groups_by_game_without_touching_the_files / organize_moves_into_folders_by_game_and_skips_duplicates / refuses_when_there_is_nothing_to_scan) with ClipOrganizerOptions where mode is 'copy' or 'move' and opts.dest is empty or whitespace-only (opts.dest.trim().is_empty()).

Common situations: A frontend or CLI builds the options struct but the user never picked a destination folder in a folder-picker dialog; dest is defaulted to "" and mode defaults to copy/move; dest is set to a string of spaces from a clipboard paste.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/games/clip_organizer.rs:327

        dirs.extend(steam::screenshot_dirs());
    }
    dirs.sort();
    dirs.dedup();
    if dirs.is_empty() {
        anyhow::bail!("escolha ao menos uma pasta de capturas");
    }

    let apps = steam::scan_apps(&steam::steam_libraries(&opts.steam_dirs));
    let fallback = if opts.fallback_game.trim().is_empty() {
        "Outros".to_string()
    } else {
        opts.fallback_game.trim().to_string()
    };

    let organizing = opts.mode == "copy" || opts.mode == "move";
    let dest_root = PathBuf::from(opts.dest.trim());
    if organizing && opts.dest.trim().is_empty() {
        anyhow::bail!("escolha a pasta de destino para organizar");
    }
    let move_it = opts.mode == "move";

    report(&progress, ID, "progress", 0, None, None);
    let found = collect(&dirs);
    let total = found.len() as u64;

    // No modo análise não há índice em disco: o `seen` abaixo já acha cópia
    // repetida dentro da rodada sem escrever nada.
    let mut index = if opts.dedupe && organizing {
        DedupeIndex::load(&dest_root)
    } else {
        DedupeIndex::disabled()
    };
    let mut seen: std::collections::HashSet<String> = std::collections::HashSet::new();

    let mut items: Vec<ImportItem> = Vec::new();
    let (mut imported, mut skipped, mut failed, mut bytes_total) = (0u64, 0u64, 0u64, 0u64);

View on GitHub (pinned to 8600b91f42)