{"record":{"id":"2097976a8b8a8d09","repo":"tonhowtf/omniget","slug":"isto-um-sub-ou-um-perfil-cole-o-link-de-um-post","errorCode":null,"errorMessage":"isto é um sub ou um perfil: cole o link de um post","messagePattern":"isto é um sub ou um perfil: cole o link de um post","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":558,"sourceCode":"    })?;\n    if let Target::Short { url } = &target {\n        let final_url = fetcher.resolve(url).await?;\n        target = parse_target(&final_url)\n            .ok_or_else(|| anyhow!(\"o link curto não levou a um post ({})\", final_url))?;\n    }\n\n    // Mídia solta e link de fora não têm post para consultar.\n    let (post, plan) = match &target {\n        Target::Post { id, .. } => {\n            let post = fetch_post(&fetcher, id).await?;\n            let plan = plan_for(&post);\n            (Some(post), plan)\n        }\n        Target::Media { url, video: true } => (None, Plan::Video { url: url.clone() }),\n        Target::Media { url, video: false } => (None, Plan::Image { url: url.clone() }),\n        Target::External { url } => (None, Plan::External { url: url.clone() }),\n        Target::Subreddit { .. } | Target::User { .. } => {\n            return Err(anyhow!(\n                \"isto é um sub ou um perfil: cole o link de um post\"\n            ))\n        }\n        Target::Short { .. } => return Err(anyhow!(\"não foi possível resolver o link curto\")),\n    };\n\n    let info = post.as_ref().map(post_info).unwrap_or_else(|| PostInfo {\n        id: String::new(),\n        title: opts\n            .url\n            .rsplit('/')\n            .find(|s| !s.is_empty())\n            .unwrap_or(\"reddit\")\n            .split('.')\n            .next()\n            .unwrap_or(\"reddit\")\n            .to_string(),\n        ..PostInfo::default()","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L540-L576","documentation":"Target-kind guard in reddit download run: the parsed link points at a subreddit or user profile rather than an individual post, and those targets have no single post media to download, so the run refuses and asks for a post link.","triggerScenarios":"Passing https://reddit.com/r/<sub> or https://reddit.com/u/<user> (or /user/<name>) URLs to baixa_um_video_de_verdade / baixa_uma_galeria_de_verdade.","commonSituations":"Copying the URL from a subreddit or profile tab instead of opening a post first; intending bulk download and calling the single-post API by mistake.","solutions":["Navigate into a specific post and use its /comments/<id>/ URL","If you need multiple posts from a sub/user, use the listing/bulk-download tool instead of this one","Strip trailing sub or /user segments and append the post id path"],"exampleFix":"// before\nurl: \"https://www.reddit.com/r/rust/\"\n// after\nurl: \"https://www.reddit.com/r/rust/comments/abc123/title/\"","handlingStrategy":"validation","validationCode":"fn is_listing_url(url: &str) -> bool {\n    let p = url.trim_end_matches('/');\n    p.contains(\"reddit.com/r/\") && p.matches('/').count() <= 5\n        || p.contains(\"reddit.com/user/\") && p.matches('/').count() <= 5\n}\n// if is_listing_url(&opts.url) { /* prompt for a specific post */ }","typeGuard":"fn url_is_single_post(url: &str) -> bool {\n    url.contains(\"reddit.com\") && url.contains(\"/comments/\")\n}","tryCatchPattern":null,"preventionTips":["Only call the single-post download API with /comments/ URLs","Route subreddit/profile URLs to a listing/bulk tool instead","Detect listing URLs in your UI before invoking the tool"],"tags":["reddit","wrong-target","input-validation"],"backgroundTag":"incompatible-source-type","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"}