tonhowtf/omniget · error · anyhow

a conta não devolveu nenhuma linha

Error message

a conta não devolveu nenhuma linha

What it means

After fetching all requested lists via get_all and merging parsed entries, run() checks whether anything was collected; an empty result is treated as an error rather than producing an empty export. It guards against silently writing empty JSON/CSV files.

Solutions

  1. Verify on trakt.tv that the account/lists actually contain items
  2. Check the list names/slugs requested in opts match real lists for the user
  3. Confirm pagination headers were honored — try increasing opts.max_pages
  4. Log the raw get_all response per list to see which one returned empty
  5. Handle the empty case in the caller by showing a friendly message instead of treating it as a crash
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check that the account has at least one list with items
let lists = trakt_get_user_lists(&config).await?;
if lists.iter().all(|l| l.item_count == 0) {
    return Err("nothing to export: all lists are empty");
}

Try / catch

if let Err(e) = trakt_lists::run(&opts, &progress).await {
    if e.to_string().contains("nenhuma linha") {
        // show 'nothing to export' notice instead of a failure dialog
        return Ok(());
    }
    return Err(e);
}

Prevention

When it happens

Trigger: Every list path in the requested set returned zero items — e.g. the account's lists are all empty, all requested list slugs don't exist, or get_all parsed no recognizable entries (parse_items matched nothing).

Common situations: New Trakt account with empty watchlist/lists; requesting a custom list by a name that doesn't exist for this user; account is private/empty; API returned success but empty arrays due to a pagination edge case.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


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

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/lists/trakt.rs:792

            .await?;
        push(
            "watchlist",
            parse_items(&v, "watchlist"),
            &mut by_part,
            &mut all,
        );
    }
    if want("lists") {
        let raw = api.get_all("/users/me/lists", 1, &p, "listas").await?;
        for (id, name) in parse_lists(&raw) {
            let path = format!("/users/me/lists/{}/items", id);
            let items = api.get_all(&path, opts.max_pages, &p, &name).await?;
            let label = format!("lista: {}", name);
            push(&label, parse_items(&items, &label), &mut by_part, &mut all);
        }
    }
    if all.is_empty() {
        return Err(anyhow!("a conta não devolveu nenhuma linha"));
    }
    all.sort_by(|a, b| b.date.cmp(&a.date).then(a.title.cmp(&b.title)));

    let dest = std::path::PathBuf::from(opts.dest.trim());
    let formats = if opts.formats.is_empty() {
        vec!["json".to_string(), "csv".to_string()]
    } else {
        opts.formats.clone()
    };
    let files = super::write_exports(&dest, "trakt", &all, &formats, |es| {
        super::merge::timeline_markdown("Trakt", es)
    })?;
    report(&p, TOOL_ID, "done", 1, Some(1), None);
    Ok(ExportResult {
        used_session: true,
        username,
        entries: all.len(),
        by_part,

View on GitHub (pinned to 8600b91f42)