{"record":{"id":"15e2ae61c69412a6","repo":"tonhowtf/omniget","slug":"isto-n-o-um-post-cole-o-link-de-uma-thread-com-comments-no","errorCode":null,"errorMessage":"isto não é um post: cole o link de uma thread (com /comments/ no meio)","messagePattern":"isto não é um post: cole o link de uma thread \\(com /comments/ no meio\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/thread.rs","lineNumber":808,"sourceCode":"    pub missing: usize,\n    pub requests: u32,\n    pub files: Vec<String>,\n    pub dest: String,\n    /// Se o arquivamento saiu com a sessão do usuário ou anônimo.\n    pub used_session: bool,\n}\n\nasync fn resolve_post(fetcher: &Fetcher, url: &str) -> Result<(String, Option<String>)> {\n    let mut target = super::parse_target(url)\n        .ok_or_else(|| anyhow!(\"cole o link de um post do Reddit (ou o id dele)\"))?;\n    if let Target::Short { url } = &target {\n        let final_url = fetcher.resolve(url).await?;\n        target = super::parse_target(&final_url)\n            .ok_or_else(|| anyhow!(\"o link curto não levou a um post ({})\", final_url))?;\n    }\n    match target {\n        Target::Post { id, subreddit, .. } => Ok((id, subreddit)),\n        _ => Err(anyhow!(\n            \"isto não é um post: cole o link de uma thread (com /comments/ no meio)\"\n        )),\n    }\n}\n\n/// Abre os \"carregar mais\" até o teto de requisições. Devolve quantos\n/// comentários ficaram de fora.\nasync fn expand(\n    fetcher: &Fetcher,\n    post_id: &str,\n    sort: &str,\n    mut mores: Vec<MoreRef>,\n    flat: &mut Vec<Comment>,\n    budget: u32,\n    progress: &ProgressFn,\n) -> usize {\n    let mut missing = 0usize;\n    let mut used = 0u32;","sourceCodeStart":790,"sourceCodeEnd":826,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/thread.rs#L790-L826","documentation":"After optional short-link resolution, resolve_post() matches the parsed Target. Only Target::Post is accepted; any other recognized Reddit target (subreddit, user, etc.) hits the wildcard arm and raises this error telling the user to supply a thread link containing /comments/.","triggerScenarios":"Calling resolve_post (via run) with a URL/id that parses to a non-post Reddit target — e.g. a subreddit link (r/example), a user page, a comment permalink, or a gallery/collection link.","commonSituations":"Users paste a subreddit or user URL when asked for a thread; they paste a link to a comment rather than the post; they paste a crosspost or gallery landing page that parse_target classifies as something other than Post.","solutions":["Provide the post permalink containing /comments/ in the path","Remove any /comment/<id> suffix and use the parent post URL","Use the raw post id instead of a subreddit or user link","If the URL is a short link, confirm it redirects to a /comments/ URL, not a subreddit"],"exampleFix":"// before\nresolve_post(&fetcher, \"https://www.reddit.com/r/rust/\").await?; // subreddit -> error\n// after\nresolve_post(&fetcher, \"https://www.reddit.com/r/rust/comments/1abcxyz/title/\").await?","handlingStrategy":"validation","validationCode":"fn looks_like_thread_url(u: &str) -> bool {\n    u.contains(\"reddit.com\") && u.contains(\"/comments/\")\n}\nif !looks_like_thread_url(input) && !(input.len() >= 5 && !input.contains('/')) {\n    eprintln!(\"input is not a thread link; expected /comments/ URL or post id\");\n}","typeGuard":"fn is_post_input(s: &str) -> bool {\n    s.contains(\"/comments/\") || s.starts_with(\"https://redd.it/\") || (s.len() <= 10 && !s.contains('/'))\n}","tryCatchPattern":"match resolve_post(&fetcher, input).await {\n    Ok((id, sub)) => download(id, sub).await,\n    Err(e) if e.to_string().contains(\"nao e um post\") => {\n        eprintln!(\"{} is not a thread; need a /comments/ URL\", input);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Validate input contains /comments/ (or is a bare id) before calling","Strip comment permalinks down to the parent post URL","Never pass subreddit or user URLs to a post-download API"],"tags":["reddit","url-parsing","invalid-argument"],"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"}