{"record":{"id":"1ca881b91abbc5a9","repo":"tonhowtf/omniget","slug":"real-esrgan-nao-esta-instalado","errorCode":null,"errorMessage":"Real-ESRGAN nao esta instalado","messagePattern":"Real-ESRGAN nao esta instalado","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/upscale.rs","lineNumber":141,"sourceCode":"fn default_scale() -> u32 {\n    4\n}\nfn default_fmt() -> String {\n    \"png\".into()\n}\n\n#[derive(Debug, Clone, Serialize)]\npub struct UpscaleResult {\n    pub outputs: Vec<String>,\n    pub failed: Vec<String>,\n}\n\npub async fn run(\n    opts: UpscaleOptions,\n    progress: super::ProgressFn,\n) -> anyhow::Result<UpscaleResult> {\n    use tokio::io::{AsyncBufReadExt, BufReader};\n    let bin = locate().ok_or_else(|| anyhow!(\"Real-ESRGAN nao esta instalado\"))?;\n    let models_dir = bin.parent().map(|p| p.join(\"models\")).unwrap_or_default();\n    let mut outputs = Vec::new();\n    let mut failed = Vec::new();\n    let total = opts.inputs.len() as u64;\n    for (i, input) in opts.inputs.iter().enumerate() {\n        let inp = Path::new(input);\n        let out_dir = if opts.output_dir.trim().is_empty() {\n            inp.parent().map(|p| p.to_path_buf()).unwrap_or_default()\n        } else {\n            PathBuf::from(opts.output_dir.trim())\n        };\n        std::fs::create_dir_all(&out_dir)?;\n        let stem = inp\n            .file_stem()\n            .map(|s| s.to_string_lossy().to_string())\n            .unwrap_or_else(|| \"imagem\".into());\n        let out = out_dir.join(format!(\"{}_{}x.{}\", stem, opts.scale, opts.format));\n        let id = format!(\"upscale:{}\", input);","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/upscale.rs#L123-L159","documentation":"upscale::run() starts by locating the installed Real-ESRGAN binary via locate(). If the tool has not been installed (or cannot be found), run aborts with 'Real-ESRGAN nao esta instalado'. This is a precondition error: the upscale feature depends on the externally-managed binary installed by install().","triggerScenarios":"Calling run(opts, progress) before install() has ever succeeded, or after the managed directory was deleted/moved so locate() returns None.","commonSituations":"Fresh app install where the user skipped tool setup; data directory wiped between runs; binary removed by antivirus or manual cleanup; running from a different user account than the one that installed it.","solutions":["Call upscale::install(progress) first, then retry run()","Verify the binary exists in the managed tools directory that locate() scans","Check that HOME/APPDATA resolve to the same user that performed the install","Restore the binary if it was removed by antivirus (whitelist the managed directory)"],"exampleFix":"// before\nupscale::run(opts, progress).await?;\n// after\nif upscale_locate().is_none() {\n    upscale::install(progress).await?;\n}\nupscale::run(opts, progress).await?;","handlingStrategy":"validation","validationCode":"fn real_esrgan_available() -> bool {\n    upscale::locate().is_some()\n}\nif !real_esrgan_available() {\n    upscale::install(&progress).await?;\n}","typeGuard":null,"tryCatchPattern":"match upscale::run(opts, &progress).await {\n    Err(e) if e.to_string().contains(\"nao esta instalado\") => {\n        upscale::install(&progress).await?;\n        upscale::run(opts, &progress).await?\n    }\n    other => other,\n}","preventionTips":["Run install() as part of first-run setup before exposing upscale features","Check locate() on app startup and prompt for install if missing","Protect the managed directory from cleanup tools and antivirus"],"tags":["missing-dependency","installation","precondition","rust"],"backgroundTag":"missing-dependency","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}