{"record":{"id":"fbd72cbd3548bf4d","repo":"tonhowtf/omniget","slug":"nao-foi-possivel-iniciar-o-gallery-dl","errorCode":null,"errorMessage":"nao foi possivel iniciar o gallery-dl: {}","messagePattern":"nao foi possivel iniciar o gallery-dl: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/gallery.rs","lineNumber":63,"sourceCode":"    progress: super::ProgressFn,\n) -> anyhow::Result<GalleryResult> {\n    use tokio::io::{AsyncBufReadExt, BufReader};\n    let bin = crate::core::dependencies::ensure_gallerydl()\n        .await\n        .ok_or_else(|| anyhow!(\"gallery-dl nao esta instalado\"))?;\n    std::fs::create_dir_all(dest)?;\n    let mut cmd = crate::core::process::command(&bin);\n    cmd.args([\"-d\", dest, \"--write-metadata\"]);\n    if let Some(c) = cookies_file.filter(|c| !c.trim().is_empty()) {\n        cmd.args([\"--cookies\", c]);\n    }\n    cmd.arg(url)\n        .stdin(std::process::Stdio::null())\n        .stdout(std::process::Stdio::piped())\n        .stderr(std::process::Stdio::piped());\n    let mut child = cmd\n        .spawn()\n        .map_err(|e| anyhow!(\"nao foi possivel iniciar o gallery-dl: {}\", e))?;\n    let stdout = child.stdout.take();\n    let stderr = child.stderr.take();\n    let id = format!(\"gallery:{}\", url);\n    let p2 = progress.clone();\n    let id2 = id.clone();\n    let out_task = tokio::spawn(async move {\n        let mut files = Vec::new();\n        if let Some(o) = stdout {\n            let mut lines = BufReader::new(o).lines();\n            while let Ok(Some(line)) = lines.next_line().await {\n                let l = line.trim().trim_start_matches(\"# \").to_string();\n                if !l.is_empty() {\n                    files.push(l.clone());\n                    super::report(&p2, &id2, \"download\", files.len() as u64, None, Some(l));\n                }\n            }\n        }\n        files","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/gallery.rs#L45-L81","documentation":"download() spawns the gallery-dl child process; if std::process::Command::spawn fails (the OS cannot start the binary), the OS error is wrapped in this message. Unlike the 'nao esta instalado' error, the binary was resolved but could not actually be executed.","triggerScenarios":"cmd.spawn() returns Err: binary path exists but is not executable, permission denied on the file, missing interpreter/shebang, or resource limits preventing process creation.","commonSituations":"Downloaded binary not marked executable on Linux/macOS; antivirus blocking execution on Windows; corrupted or zero-length binary; exec format mismatch (arm64 binary on x64).","solutions":["Check the OS error in the message — 'Permission denied' means chmod +x (Unix) or unblock the binary","Reinstall/re-download gallery-dl — the binary may be corrupt or for the wrong architecture","Confirm the resolved path runs directly from a shell: `<path> --version`"],"exampleFix":"// before (linux fix, terminal)\ngallery-dl --version\n// permission denied? after\nchmod +x $(which gallery-dl)","handlingStrategy":"try-catch","validationCode":"// ensure the resolved binary is executable\nuse std::os::unix::fs::PermissionsExt;\nlet meta = std::fs::metadata(&bin)?;\nif meta.permissions().mode() & 0o111 == 0 {\n    std::fs::set_permissions(&bin, std::fs::Permissions::from_mode(0o755))?;\n}","typeGuard":null,"tryCatchPattern":"match gallery::download(url, dest, cookies, progress).await {\n    Err(e) if e.to_string().contains(\"nao foi possivel iniciar\") => {\n        // fix permissions / reinstall, then retry once\n        reinstall_gallerydl().await?;\n        gallery::download(url, dest, cookies, progress).await?\n    }\n    other => other?,\n}","preventionTips":["After downloading binaries, set the executable bit on Unix","Whitelist the binary in antivirus/Defender on Windows","Verify the binary architecture matches the host before executing"],"tags":["process-spawn","gallery-dl","permissions"],"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"}