tonhowtf/omniget · error

escolha a pasta da biblioteca de destino

Error message

escolha a pasta da biblioteca de destino

What it means

Thrown by SwitchAlbum's `run` when the destination field (`opts.dest`) is empty or whitespace-only. The tool requires an explicit target library folder so downloads from the card are never written to an unintended default location.

Solutions

  1. Set `dest` to an existing library directory path in the UI/config before calling `run`
  2. In the frontend, disable submit until the destination folder picker has a value
  3. If invoked programmatically, pass the intended library root explicitly

Example fix

// before
SwitchOptions { source: card_path, dest: "".into(), mode: "copy".into() }
// after
SwitchOptions { source: card_path, dest: library_dir.into(), mode: "copy".into() }
Defensive patterns

Strategy: validation

Validate before calling

if dest.trim().is_empty() {
    return Err("destination library folder is required".to_string());
}
if !std::path::Path::new(dest.trim()).is_dir() {
    return Err("destination must be an existing directory".to_string());
}

Type guard

fn has_dest(opts: &SwitchOptions) -> bool {
    !opts.dest.trim().is_empty()
}

Try / catch

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

Prevention

When it happens

Trigger: Calling `run(SwitchOptions { dest: "", .. })` or `dest: " "` — any value whose `.trim()` is empty, regardless of source validity.

Common situations: Frontend form submitted without picking a destination folder; state reset cleared the dest picker; programmatic use omitted the `dest` field in the options struct.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

        ])
        .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,
            failed: 0,
            bytes_imported: 0,
            unknown_ids: Vec::new(),
            dry_run: opts.dry_run,

View on GitHub (pinned to 8600b91f42)