tonhowtf/omniget · error · anyhow::Error

cole a URL da coleção (…/@usuario/collection/nome-id)

Error message

cole a URL da coleção (…/@usuario/collection/nome-id)

What it means

In list_public(), when source == "collection" but parse_target resolved the input to anything other than Target::Collection (typically a plain user), the function rejects the combination with this anyhow error. It enforces that collection listings only run against a genuine collection URL.

Solutions

  1. Provide the full collection URL in the form https://www.tiktok.com/@usuario/collection/nome-id.
  2. Alternatively, if you actually want the user's public content, change source from "collection" to "user".
  3. In a UI, validate that the pasted URL contains /collection/ before selecting the collection mode.

Example fix

// before
list_public("@usuario", "collection", 50, None).await?;
// after
list_public("https://www.tiktok.com/@usuario/collection/favoritos-987654321", "collection", 50, None).await?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust
fn require_collection_url(input: &str, source: &str) -> Result<(), String> {
    if source == "collection" && !input.contains("/collection/") {
        return Err("modo collection exige a URL .../collection/nome-id".into());
    }
    Ok(())
}

Type guard

fn as_collection(t: &Target) -> Option<&str> {
    if let Target::Collection { name, .. } = t { Some(name) } else { None }
}

Try / catch

match list_public(input, "collection", limit, None).await {
    Ok(entries) => render(entries),
    Err(e) if e.to_string().contains("URL da coleção") => eprintln!("Cole a URL completa da coleção, não o perfil"),
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling list_public with source="collection" and an input that parses as Target::User (e.g. just @usuario or a profile URL) instead of a .../collection/nome-id URL.

Common situations: Developer copies the profile URL but forgets to navigate into the Favorites/Collections folder to copy the full collection URL; or passes only the handle while meaning to list a collection.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

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

        Some(super::Target::Video {
            user: Some(user), ..
        }) => user,
        _ => input.trim().trim_start_matches('@').to_ascii_lowercase(),
    }
}

async fn list_public(
    input: &str,
    source: &str,
    limit: u32,
    cookies: Option<&std::path::Path>,
) -> Result<Vec<Entry>> {
    let target = super::parse_target(input)
        .ok_or_else(|| anyhow!("não reconheci esse perfil ou coleção: {}", input))?;
    let url = match (source, &target) {
        ("collection", super::Target::Collection { .. }) => super::canonical_url(&target),
        ("collection", _) => {
            return Err(anyhow!(
                "cole a URL da coleção (…/@usuario/collection/nome-id)"
            ))
        }
        _ => super::canonical_url(&super::Target::User {
            name: handle_of(input),
        }),
    };
    let v = super::ytdlp_json(&super::ytdlp_list_args(&url, limit, cookies)).await?;
    Ok(entries_from_list(&v))
}

async fn list_private(
    opts: &Options,
    handle: &str,
    progress: &ProgressFn,
    pacer: &Pacer,
) -> Result<Vec<Entry>> {
    let session = opts

View on GitHub (pinned to 8600b91f42)