{"record":{"id":"178bf3caa0a93cfd","repo":"tonhowtf/omniget","slug":"n-o-foi-poss-vel-resolver-o-link-curto","errorCode":null,"errorMessage":"não foi possível resolver o link curto","messagePattern":"não foi possível resolver o link curto","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":562,"sourceCode":"            .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()\n    });\n    let base = base_name(&info);\n\n    let (kind, source, mut files, log_tail) = match &plan {","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L544-L580","documentation":"Defensive branch: the URL was still Target::Short at plan selection, meaning the earlier resolve/re-parse left an un-resolved short target in scope. The library treats this as an unreachable-but-possible state and throws rather than guessing a target.","triggerScenarios":"Only reachable if a Target::Short survives the resolution step in run() (e.g. the resolve path re-introduced a Short target from the final URL), or in tests exercising the match arm directly.","commonSituations":"Rare; typically indicates the resolver returned a final URL that parse_target again classified as a short link (redirect chains between short-link forms).","solutions":["Pass the fully expanded post URL directly instead of a short link","If persistent, inspect fetcher.resolve() behavior for redirect loops between short-link forms","Update to a version where short-link resolution is fixed if you rely on redd.it links"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = run(opts).await {\n    if e.to_string().contains(\"não foi possível resolver o link curto\") {\n        // expand short link externally and retry with the full URL\n    }\n}","preventionTips":["Pass fully expanded post URLs rather than short links","Keep the library updated so short-link resolution handles redirect chains","Treat this as a should-never-happen signal and log full input URL when it fires"],"tags":["reddit","url-resolution","invariant"],"backgroundTag":"internal-invariant-violation","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"}