{"record":{"id":"aeddd1dd97b242f6","repo":"tonhowtf/omniget","slug":"failed-to-start-gallery-dl","errorCode":null,"errorMessage":"Failed to start gallery-dl: {}","messagePattern":"Failed to start gallery-dl: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/gallerydl/mod.rs","lineNumber":238,"sourceCode":"            if std::fs::create_dir_all(&archive_dir).is_ok() {\n                cmd.arg(\"--download-archive\")\n                    .arg(archive_dir.join(\"gallery-dl.txt\"));\n            }\n            let cookie_file = data_dir.join(\"chrome-extension-cookies.txt\");\n            if std::fs::metadata(&cookie_file)\n                .map(|m| m.len() > 0)\n                .unwrap_or(false)\n            {\n                cmd.arg(\"--cookies\").arg(&cookie_file);\n            }\n        }\n\n        cmd.arg(\"--\").arg(&url);\n\n        cmd.kill_on_drop(true);\n        let mut child = cmd\n            .spawn()\n            .map_err(|e| anyhow!(\"Failed to start gallery-dl: {}\", e))?;\n\n        let stdout = child\n            .stdout\n            .take()\n            .ok_or_else(|| anyhow!(\"No stdout from gallery-dl\"))?;\n        let stderr_pipe = child\n            .stderr\n            .take()\n            .ok_or_else(|| anyhow!(\"No stderr from gallery-dl\"))?;\n\n        let started_at = SystemTime::now();\n\n        let progress_tx = progress.clone();\n        let reader_task = tokio::spawn(async move {\n            let mut lines = BufReader::new(stdout).lines();\n            let mut count: u64 = 0;\n            let mut last_emit = std::time::Instant::now();\n            while let Ok(Some(line)) = lines.next_line().await {","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/gallerydl/mod.rs#L220-L256","documentation":"Spawning the gallery-dl child process failed, so the download cannot proceed. `Command::spawn()` returned an OS error (wrapped into this anyhow error) — typically the binary path is invalid or not executable.","triggerScenarios":"Calling gallerydl `download` after `ensure_gallerydl()` returned a path that no longer exists, was replaced mid-run, lacks the executable bit, or cannot be executed due to sandbox/permission restrictions.","commonSituations":"Binary auto-updated/deleted between ensure and spawn, downloaded binary missing +x permissions, macOS Gatekeeper/app-sandbox blocking the spawned executable, or antivirus quarantining the binary on Windows.","solutions":["Check the wrapped OS error message to confirm the cause (NotFound vs PermissionDenied).","Re-run `ensure_gallerydl()` (or restart the app) so a valid, existing binary path is used.","Ensure the gallery-dl binary has the executable bit: `chmod +x <path-to-gallery-dl>`.","On macOS/Windows, approve/quarantine-unblock the binary so the sandboxed app may execute it."],"exampleFix":"// before\nlet bin = ensure_gallerydl().await.ok_or_else(|| anyhow!(\"gallery-dl not available\"))?;\nlet mut child = cmd.spawn().map_err(|e| anyhow!(\"Failed to start gallery-dl: {}\", e))?;\n// after\nlet bin = ensure_gallerydl().await.ok_or_else(|| anyhow!(\"gallery-dl not available\"))?;\nif !bin.exists() {\n    anyhow::bail!(\"gallery-dl binary missing at {:?}, re-installing\", bin);\n}\nlet mut child = cmd.spawn().map_err(|e| anyhow!(\"Failed to start gallery-dl at {:?}: {}\", bin, e))?;","handlingStrategy":"retry","validationCode":"// Rust, before spawning\nlet bin = omniget_core::core::dependencies::ensure_gallerydl().await.ok_or_else(|| anyhow!(\"gallery-dl missing\"))?;\nuse std::os::unix::fs::PermissionsExt;\nlet md = std::fs::metadata(&bin).map_err(|e| anyhow!(\"gallery-dl binary missing at {:?}: {}\", bin, e))?;\nif md.permissions().mode() & 0o111 == 0 {\n    std::fs::set_permissions(&bin, std::fs::Permissions::from_mode(0o755))?;\n}","typeGuard":null,"tryCatchPattern":"// Rust\nlet child = match cmd.spawn() {\n    Ok(c) => c,\n    Err(e) if e.kind() == std::io::ErrorKind::NotFound => {\n        // re-ensure the binary, then retry once\n        let _ = ensure_gallerydl().await;\n        cmd.spawn().map_err(|e| anyhow!(\"Failed to start gallery-dl after re-ensure: {}\", e))?\n    }\n    Err(e) => return Err(anyhow!(\"Failed to start gallery-dl: {}\", e)),\n};","preventionTips":["Verify the resolved binary path exists and is executable right before spawn.","Re-run ensure_gallerydl() if the binary was auto-updated or deleted between calls.","On macOS/Windows, pre-approve the binary (Gatekeeper/quarantine) in managed deployments."],"tags":["process","gallery-dl","spawn","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"}