{"record":{"id":"a5bb98290e23c75f","repo":"tonhowtf/omniget","slug":"o-link-curto-n-o-levou-a-um-post-thread","errorCode":null,"errorMessage":"o link curto não levou a um post ({})","messagePattern":"o link curto não levou a um post \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/thread.rs","lineNumber":804,"sourceCode":"    pub subreddit: String,\n    pub author: String,\n    pub permalink: String,\n    pub comments: usize,\n    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,","sourceCodeStart":786,"sourceCodeEnd":822,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/thread.rs#L786-L822","documentation":"resolve_post() in the Reddit thread tool accepts a post URL/id and, if it detects a Reddit short link (Target::Short, e.g. redd.it/xxxx), resolves it via HTTP redirect to the final URL and re-parses. This error is thrown when the redirect target, after re-parsing, still does not yield any recognized Reddit target (post, subreddit, user, etc.) — parse_target returned None for the final URL.","triggerScenarios":"Calling resolve_post (via run) with a short link (redd.it or share link) whose redirect does not land on a parseable Reddit post URL — e.g. the short id points to a removed post, a non-post resource, or fetcher.resolve returned an intermediate/aggregate URL that parse_target cannot classify.","commonSituations":"Users paste shortened share links from the Reddit mobile app for posts that were deleted/removed; expired or malformed share links redirect to a generic Reddit page; network middleware (login walls, consent pages) intercepts the redirect.","solutions":["Ask the user to paste the full permalink containing /comments/ instead of the short link","Check that the short link actually resolves in a browser (post not removed/deleted)","If you have the post id (base36 after the short domain), pass the raw id instead of the short URL","Retry later if Reddit is returning an error/consent interstitial instead of the redirect"],"exampleFix":"// before\nresolve_post(&fetcher, \"https://redd.it/1abcxyz\").await?;\n// after\n// verify it resolves, or use the canonical form\nresolve_post(&fetcher, \"https://www.reddit.com/r/someSub/comments/1abcxyz/post_title/\").await?","handlingStrategy":"validation","validationCode":"// resolve the short link yourself and check it looks like a post permalink\nlet final_url = reqwest::get(short_url).await?.url().to_string();\nif !final_url.contains(\"/comments/\") {\n    eprintln!(\"short link does not lead to a post: {}\", final_url);\n}","typeGuard":"fn is_reddit_post_url(u: &str) -> bool { u.contains(\"reddit.com\") && u.contains(\"/comments/\") }","tryCatchPattern":"match resolve_post(&fetcher, input).await {\n    Ok((id, sub)) => download(id, sub).await,\n    Err(e) if e.to_string().contains(\"link curto\") => {\n        eprintln!(\"short link dead; ask user for the /comments/ permalink\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Prefer full /comments/ permalinks or raw post ids over redd.it short links","Test short links in a browser before feeding them to the tool","Account for deleted/removed posts when accepting user-supplied links"],"tags":["reddit","url-parsing","short-link"],"backgroundTag":"invalid-url","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"}