tonhowtf/omniget · error · anyhow::Error

escolha a pasta de destino

Error message

escolha a pasta de destino

What it means

After validating the profile, `run` checks that `opts.dest` names a destination folder; if it is empty or whitespace the tool refuses to proceed with this message. The destination is required because downloaded favorite videos are written to that directory (created immediately afterwards with create_dir_all).

Solutions

  1. Set opts.dest to a valid directory path before calling run.
  2. In the UI, require a folder selection before enabling the action.
  3. If dest is omitted, prompt the user or fall back to a sensible default directory upstream.

Example fix

// before
let opts = Options { user: "@someuser".into(), dest: "".into(), ..Default::default() };
// after
let opts = Options { user: "@someuser".into(), dest: "/tmp/favorites".into(), ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

if opts.dest.trim().is_empty() {
    return Err(anyhow!("escolha a pasta de destino antes de iniciar"));
}

Type guard

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

Prevention

When it happens

Trigger: Calling `run(opts, progress)` with `opts.dest` equal to "" or whitespace; forgetting to bind the folder-picker result to Options; deserializing Options from a request where the dest key was omitted and defaulted to an empty string.

Common situations: A Tauri frontend sends the command without the user having chosen an output folder; config file has an empty `dest` key; a refactor renamed the field and the call site stopped populating it.

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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/tiktok/favorites.rs:436

        if vazio || !has_more || next.is_empty() || next == cursor || out.len() as u32 >= teto {
            break;
        }
        cursor = next;
    }
    if out.is_empty() {
        return Err(anyhow!(
            "a lista voltou vazia — o TikTok não entregou os favoritos para esta sessão"
        ));
    }
    Ok(out)
}

pub async fn run(opts: &Options, progress: ProgressFn) -> Result<FavoritesResult> {
    if opts.user.trim().is_empty() {
        return Err(anyhow!("informe o perfil (@usuario) ou a URL da coleção"));
    }
    if opts.dest.trim().is_empty() {
        return Err(anyhow!("escolha a pasta de destino"));
    }
    let dest = PathBuf::from(&opts.dest);
    std::fs::create_dir_all(&dest)?;

    let session = TempCookies::new(opts.session_netscape.as_deref());
    let used_session = session.is_some();
    let cookies: Option<PathBuf> = opts
        .cookies
        .as_deref()
        .filter(|c| !c.trim().is_empty())
        .map(PathBuf::from)
        .or_else(|| session.path().map(|p| p.to_path_buf()));

    let handle = handle_of(&opts.user);
    let pacer = Pacer::new(opts.delay_ms);
    report(&progress, ID, "started", 0, None, None);

    let mut entries = match opts.source.as_str() {

View on GitHub (pinned to 8600b91f42)