{"record":{"id":"b4b488add111b20b","repo":"tonhowtf/omniget","slug":"o-gallery-dl-falhou","errorCode":null,"errorMessage":"o gallery-dl falhou: {}","messagePattern":"o gallery-dl falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs","lineNumber":392,"sourceCode":"        files\n    });\n    let err_task = tokio::spawn(async move {\n        let mut tail = String::new();\n        if let Some(e) = stderr {\n            let mut lines = BufReader::new(e).lines();\n            while let Ok(Some(line)) = lines.next_line().await {\n                if !line.trim().is_empty() {\n                    tail = line;\n                }\n            }\n        }\n        tail\n    });\n    let status = child.wait().await?;\n    let files = out_task.await.unwrap_or_default();\n    let log_tail = err_task.await.unwrap_or_default();\n    if !status.success() && files.is_empty() {\n        return Err(anyhow!(\"o gallery-dl falhou: {}\", log_tail));\n    }\n    Ok(Downloaded { files, log_tail })\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    const DUMP: &str = r#\"[\n      [2, {\"category\": \"tumblr\", \"blog_name\": \"estudio\"}],\n      [3, \"https://64.media.tumblr.com/abc/foto_1280.jpg\",\n        {\"id\": 700111222, \"blog_name\": \"estudio\", \"type\": \"photo\",\n         \"tags\": [\"arte\", \"aquarela\"], \"date\": \"2024-03-02 10:00:00\",\n         \"post_url\": \"https://estudio.tumblr.com/post/700111222\"}],\n      [6, \"https://outro.tumblr.com/post/1\", {\"category\": \"tumblr\"}]\n    ]\"#;\n\n    #[test]","sourceCodeStart":374,"sourceCodeEnd":410,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs#L374-L410","documentation":"download() treats the run as failed only when gallery-dl exited non-success AND no files were collected from stdout; in that case it throws this error with the stderr log tail as detail. If any files were produced, partial success is accepted and returned in Downloaded { files, log_tail }.","triggerScenarios":"gallery-dl exits with non-zero status and zero files were parsed: download aborted early (403, 404, network drop), disk full preventing output, extractor error, or auth rejection.","commonSituations":"Target media requires cookies that expired; Tumblr post removed/private; disk quota exceeded on dest; rate limiting interrupted the first file; broken extractor after a site layout change.","solutions":["Read log_tail in the error for gallery-dl's own diagnostic","Refresh cookies if the content is behind login","Check free disk space and write permissions on the destination folder","Retry with backoff on transient network/rate-limit errors; update gallery-dl if the extractor is outdated"],"exampleFix":"// before\nlet out = gdl::download(&url, &dest, Some(&cookies), limit, &progress).await?;\n// after\nlet out = match gdl::download(&url, &dest, Some(&cookies), limit, &progress).await {\n    Ok(o) if o.files.is_empty() && !o.log_tail.contains(\"403\") => o,\n    Err(e) if e.to_string().contains(\"falhou\") => {\n        refresh_cookies(&mut session)?;\n        gdl::download(&url, &dest, Some(&session.cookie_path()), limit, &progress).await?\n    }\n    other => other?,\n};","handlingStrategy":"retry","validationCode":"let free = fs2::available_space(&dest)?;\nanyhow::ensure!(free > 100 * 1024 * 1024, \"espaço insuficiente em {:?}\", dest);","typeGuard":null,"tryCatchPattern":"match gdl::download(&url, &dest, cookies, limit, &progress).await {\n    Ok(d) => d,\n    Err(e) if e.to_string().contains(\"o gallery-dl falhou\") => {\n        if is_transient(&e) { retry_with_backoff(3, || gdl::download(&url, &dest, cookies, limit, &progress)).await? }\n        else { return Err(e); }\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check disk space and destination writability before downloading","Refresh cookies for authenticated content","Retry with exponential backoff on transient failures","Keep gallery-dl updated for extractor fixes"],"tags":["download","gallery-dl","external-process","http-error"],"backgroundTag":"http-error-response","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"}