{"record":{"id":"c2b366b6995d3140","repo":"tonhowtf/omniget","slug":"n-o-foi-poss-vel-iniciar-o-gallery-dl","errorCode":null,"errorMessage":"não foi possível iniciar o gallery-dl: {}","messagePattern":"não foi possível iniciar o gallery-dl: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs","lineNumber":266,"sourceCode":"    let mut cmd = crate::core::process::command(&bin);\n    cmd.arg(\"-j\");\n    if let Some(r) = range_arg(limit) {\n        cmd.args([\"--range\", &r]);\n    }\n    if let Some(c) = cookies {\n        cmd.arg(\"--cookies\").arg(c);\n    }\n    for a in extra {\n        cmd.arg(a);\n    }\n    cmd.arg(url)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow!(\"não foi possível iniciar o gallery-dl: {}\", e))?;\n    let mut stdout = child\n        .stdout\n        .take()\n        .ok_or_else(|| anyhow!(\"o gallery-dl não abriu a saída padrão\"))?;\n    let stderr = child.stderr.take();\n\n    let err_task = tokio::spawn(async move {\n        use tokio::io::{AsyncBufReadExt, BufReader};\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","sourceCodeStart":248,"sourceCodeEnd":284,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/tumblr/gdl.rs#L248-L284","documentation":"dump() builds a tokio Command for gallery-dl and spawns it; if the OS fails to create the process (executable missing despite earlier checks, exec permission denied, etc.) the spawn error is wrapped in this message with the underlying io::Error interpolated.","triggerScenarios":"Command::spawn() returns Err: binary path resolved by binary() no longer exists or is not executable at spawn time, PATH lookup failed, or the exec failed due to permissions/ENODEV-style OS errors.","commonSituations":"Binary deleted between resolution and spawn; downloaded file lacks the executable bit (Linux/macOS); PATH changed at runtime; sandbox or security policy blocks executing downloaded binaries.","solutions":["Read the wrapped io::Error in the message to identify the exact OS failure (NotFound, PermissionDenied, etc.)","Re-run ensure_gallerydl()/reinstall gallery-dl if the binary vanished","chmod +x the gallery-dl binary on Unix systems","Whitelist the binary in antivirus/security policy on Windows"],"exampleFix":"// before\n// PermissionDenied on downloaded binary\nlet dump = gdl::dump(&url, cookies, limit).await?;\n// after\nlet path = gdl::binary_path().await?;\nuse std::os::unix::fs::PermissionsExt;\nstd::fs::set_permissions(&path, std::fs::Permissions::from_mode(0o755))?;\nlet dump = gdl::dump(&url, cookies, limit).await?;","handlingStrategy":"try-catch","validationCode":"use std::os::unix::fs::PermissionsExt;\nif let Ok(md) = std::fs::metadata(&bin) {\n    anyhow::ensure!(md.permissions().mode() & 0o111 != 0, \"gallery-dl sem permissão de execução\");\n}","typeGuard":null,"tryCatchPattern":"match gdl::dump(&url, cookies, limit).await {\n    Ok(d) => d,\n    Err(e) if e.to_string().contains(\"não foi possível iniciar o gallery-dl\") => {\n        eprintln!(\"verifique existência/permissão do binário: {e}\");\n        return Err(e);\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["chmod +x downloaded binaries on Unix","Exclude the binary directory from antivirus scanning","Re-resolve the binary path right before spawning"],"tags":["process-spawn","gallery-dl","io","rust"],"backgroundTag":"command-not-found","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"}