tonhowtf/omniget · error

escolha a pasta de destino

Error message

escolha a pasta de destino

What it means

Thrown at the start of the merge tool's synchronous run() when opts.dest is blank or whitespace-only. The merge tool writes its merged output files into the destination directory, so it requires one; the check happens before files are collected.

Solutions

  1. Set opts.dest to a valid directory path before calling run.
  2. Validate dest non-empty in the UI/config layer before invoking the tool.
  3. Trim the input and reject empties early with a clearer message.

Example fix

// before
let opts = merge::Options { dest: " ".into(), .. };
merge::run(&opts, &p)?;
// after
let dest = "~/merged".trim();
assert!(!dest.is_empty());
let opts = merge::Options { dest: dest.to_string(), .. };
merge::run(&opts, &p)?;
Defensive patterns

Strategy: validation

Validate before calling

if opts.dest.trim().is_empty() {
    return Err(anyhow!("dest é obrigatório: informe a pasta de saída do merge"));
}
std::fs::create_dir_all(opts.dest.trim())?;

Type guard

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

Try / catch

match merge::run(&opts, &p) {
    Err(e) if e.to_string().contains("pasta de destino") => eprintln!("escolha a pasta de destino antes de mesclar"),
    other => other?,
}

Prevention

When it happens

Trigger: Calling run(&opts, &p) with opts.dest set to "" or only whitespace.

Common situations: Merge destination field left empty in the UI; config missing the dest key; default Options constructed with dest: String::new(); whitespace-only paste.

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/b37d87d35a684da9. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/lists/merge.rs:511

    if !e.date.is_empty() {
        s.push_str(&format!(" · {}", e.date));
    }
    if e.times > 1 {
        s.push_str(&format!(" · {}×", e.times));
    }
    s.push('\n');
    if !e.review.is_empty() {
        let review = e.review.replace('\n', " ");
        s.push_str(&format!("  > {}\n", review.trim()));
    }
    s
}

// ── Execução ────────────────────────────────────────────────────────────

pub fn run(opts: &Options, p: &ProgressFn) -> Result<MergeResult> {
    if opts.dest.trim().is_empty() {
        return Err(anyhow!("escolha a pasta de destino"));
    }
    let files = collect_files(&opts.inputs);
    if files.is_empty() && opts.spotify.is_empty() {
        return Err(anyhow!(
            "aponte os exports do Letterboxd, do Trakt ou do Goodreads (JSON ou CSV)"
        ));
    }
    let total = (files.len() + opts.spotify.len().min(1)) as u64;
    let mut sources = Vec::new();
    let mut all: Vec<Entry> = Vec::new();

    for (i, f) in files.iter().enumerate() {
        let name = f.to_string_lossy().to_string();
        report(
            p,
            TOOL_ID,
            "progress",
            i as u64,

View on GitHub (pinned to 8600b91f42)