{"record":{"id":"713b6b928d8e3e36","repo":"tonhowtf/omniget","slug":"cole-a-url-da-cole-o-usuario-collection-nome-id","errorCode":null,"errorMessage":"cole a URL da coleção (…/@usuario/collection/nome-id)","messagePattern":"cole a URL da coleção \\(…/@usuario/collection/nome-id\\)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tiktok/favorites.rs","lineNumber":334,"sourceCode":"        Some(super::Target::Video {\n            user: Some(user), ..\n        }) => user,\n        _ => input.trim().trim_start_matches('@').to_ascii_lowercase(),\n    }\n}\n\nasync fn list_public(\n    input: &str,\n    source: &str,\n    limit: u32,\n    cookies: Option<&std::path::Path>,\n) -> Result<Vec<Entry>> {\n    let target = super::parse_target(input)\n        .ok_or_else(|| anyhow!(\"não reconheci esse perfil ou coleção: {}\", input))?;\n    let url = match (source, &target) {\n        (\"collection\", super::Target::Collection { .. }) => super::canonical_url(&target),\n        (\"collection\", _) => {\n            return Err(anyhow!(\n                \"cole a URL da coleção (…/@usuario/collection/nome-id)\"\n            ))\n        }\n        _ => super::canonical_url(&super::Target::User {\n            name: handle_of(input),\n        }),\n    };\n    let v = super::ytdlp_json(&super::ytdlp_list_args(&url, limit, cookies)).await?;\n    Ok(entries_from_list(&v))\n}\n\nasync fn list_private(\n    opts: &Options,\n    handle: &str,\n    progress: &ProgressFn,\n    pacer: &Pacer,\n) -> Result<Vec<Entry>> {\n    let session = opts","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tiktok/favorites.rs#L316-L352","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide the full collection URL in the form https://www.tiktok.com/@usuario/collection/nome-id.","Alternatively, if you actually want the user's public content, change source from \"collection\" to \"user\".","In a UI, validate that the pasted URL contains /collection/ before selecting the collection mode."],"exampleFix":"// before\nlist_public(\"@usuario\", \"collection\", 50, None).await?;\n// after\nlist_public(\"https://www.tiktok.com/@usuario/collection/favoritos-987654321\", \"collection\", 50, None).await?;","handlingStrategy":"validation","validationCode":"// Rust\nfn require_collection_url(input: &str, source: &str) -> Result<(), String> {\n    if source == \"collection\" && !input.contains(\"/collection/\") {\n        return Err(\"modo collection exige a URL .../collection/nome-id\".into());\n    }\n    Ok(())\n}","typeGuard":"fn as_collection(t: &Target) -> Option<&str> {\n    if let Target::Collection { name, .. } = t { Some(name) } else { None }\n}","tryCatchPattern":"match list_public(input, \"collection\", limit, None).await {\n    Ok(entries) => render(entries),\n    Err(e) if e.to_string().contains(\"URL da coleção\") => eprintln!(\"Cole a URL completa da coleção, não o perfil\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Check the URL contains /collection/ whenever collection mode is selected.","In UIs, disable collection mode when the input parses as a plain user.","Copy the collection URL directly from the browser address bar inside the collection page.","Document the difference between profile and collection inputs for users."],"tags":["tiktok","argument-mismatch","invalid-url","rust"],"backgroundTag":"invalid-argument-value","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}