{"record":{"id":"6df56e890c35b01d","repo":"tonhowtf/omniget","slug":"galeria-falhou-gallery-dl","errorCode":null,"errorMessage":"galeria falhou ({}); gallery-dl: {}","messagePattern":"galeria falhou \\((.+?)\\); gallery-dl: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":600,"sourceCode":"            let (f, tail) = run_ytdlp(url, &dest, &base, opts, &progress).await?;\n            (\"video\", \"yt-dlp\", f, tail)\n        }\n        Plan::External { url } => {\n            let (f, tail) = run_ytdlp(url, &dest, &base, opts, &progress).await?;\n            (\"external\", \"yt-dlp\", f, tail)\n        }\n        Plan::Image { url } => {\n            let f = download_direct(&fetcher, std::slice::from_ref(url), &dest, &base, &progress)\n                .await?;\n            (\"image\", \"direto\", f, String::new())\n        }\n        Plan::Gallery { urls } => {\n            match download_direct(&fetcher, urls, &dest, &base, &progress).await {\n                Ok(f) => (\"gallery\", \"direto\", f, String::new()),\n                Err(e) => {\n                    let (f, tail) = download_gallery_dl(&info.permalink, &dest, &progress)\n                        .await\n                        .map_err(|g| anyhow!(\"galeria falhou ({}); gallery-dl: {}\", e, g))?;\n                    (\"gallery\", \"gallery-dl\", f, tail)\n                }\n            }\n        }\n        Plan::TextOnly => (\"text\", \"nenhum\", Vec::new(), String::new()),\n    };\n\n    if opts.write_info && post.is_some() {\n        let want_json = opts.info_format != \"txt\";\n        let want_txt = opts.info_format == \"txt\" || opts.info_format == \"both\";\n        if want_json {\n            let path = dest.join(format!(\"{}.json\", base));\n            std::fs::write(&path, serde_json::to_string_pretty(&info)?)?;\n            files.push(path.to_string_lossy().to_string());\n        }\n        if want_txt {\n            let path = dest.join(format!(\"{}.txt\", base));\n            std::fs::write(&path, info_txt(&info))?;","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L582-L618","documentation":"Plan::Gallery downloads failed twice: the direct fetch of each gallery URL returned Err(e), and the gallery-dl fallback also failed with error g. The library aggregates both errors into this single message so you can see the direct failure and the fallback failure together.","triggerScenarios":"Gallery post whose image URLs 404/expired or fail auth (direct path), and gallery-dl is absent, failing, or rate-limited on info.permalink (fallback path).","commonSituations":"gallery-dl not installed or not on PATH; Reddit rate-limiting anonymous requests; deleted/quarantined galleries; media hosts returning 403 for hotlinked images.","solutions":["Read both parts of the message: fix the direct error e first (usually expired/403 media URLs)","Ensure gallery-dl is installed and runnable: `gallery-dl --version`","Run with a session cookie (opts.session_netscape) to avoid Reddit rate limits/blocks","Confirm the post/gallery still exists at info.permalink in a browser"],"exampleFix":"// shell: install fallback downloader\n// before: gallery-dl missing -> \"galeria falhou (404); gallery-dl: No such file...\"\n// after\npip install gallery-dl && gallery-dl --version","handlingStrategy":"try-catch","validationCode":"// before calling, verify gallery-dl availability\nlet ok = std::process::Command::new(\"gallery-dl\").arg(\"--version\").output().is_ok();\nif !ok { eprintln!(\"gallery-dl missing — install it for gallery fallback\"); }","typeGuard":null,"tryCatchPattern":"match run(opts).await {\n    Err(e) if e.to_string().starts_with(\"galeria falhou\") => {\n        // parse 'galeria falhou ({direct}); gallery-dl: {fallback}' and act:\n        // retry later (rate limit), install gallery-dl, or fetch media manually\n    }\n    other => other?,\n}","preventionTips":["Install gallery-dl as a prerequisite when handling gallery posts","Use session_netscape cookies to reduce 403/429 direct-download failures","Verify the gallery post is still live before downloading","Retry with backoff when the direct error suggests rate limiting"],"tags":["reddit","download-failure","gallery-dl","fallback"],"backgroundTag":"download-failed","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"}