tonhowtf/omniget · error

Real-ESRGAN nao esta instalado

Error message

Real-ESRGAN nao esta instalado

What it means

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().

Solutions

  1. Call upscale::install(progress) first, then retry run()
  2. Verify the binary exists in the managed tools directory that locate() scans
  3. Check that HOME/APPDATA resolve to the same user that performed the install
  4. Restore the binary if it was removed by antivirus (whitelist the managed directory)

Example fix

// before
upscale::run(opts, progress).await?;
// after
if upscale_locate().is_none() {
    upscale::install(progress).await?;
}
upscale::run(opts, progress).await?;
Defensive patterns

Strategy: validation

Validate before calling

fn real_esrgan_available() -> bool {
    upscale::locate().is_some()
}
if !real_esrgan_available() {
    upscale::install(&progress).await?;
}

Try / catch

match upscale::run(opts, &progress).await {
    Err(e) if e.to_string().contains("nao esta instalado") => {
        upscale::install(&progress).await?;
        upscale::run(opts, &progress).await?
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling run(opts, progress) before install() has ever succeeded, or after the managed directory was deleted/moved so locate() returns None.

Common situations: 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.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/1ca881b91abbc5a9. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/upscale.rs:141

fn default_scale() -> u32 {
    4
}
fn default_fmt() -> String {
    "png".into()
}

#[derive(Debug, Clone, Serialize)]
pub struct UpscaleResult {
    pub outputs: Vec<String>,
    pub failed: Vec<String>,
}

pub async fn run(
    opts: UpscaleOptions,
    progress: super::ProgressFn,
) -> anyhow::Result<UpscaleResult> {
    use tokio::io::{AsyncBufReadExt, BufReader};
    let bin = locate().ok_or_else(|| anyhow!("Real-ESRGAN nao esta instalado"))?;
    let models_dir = bin.parent().map(|p| p.join("models")).unwrap_or_default();
    let mut outputs = Vec::new();
    let mut failed = Vec::new();
    let total = opts.inputs.len() as u64;
    for (i, input) in opts.inputs.iter().enumerate() {
        let inp = Path::new(input);
        let out_dir = if opts.output_dir.trim().is_empty() {
            inp.parent().map(|p| p.to_path_buf()).unwrap_or_default()
        } else {
            PathBuf::from(opts.output_dir.trim())
        };
        std::fs::create_dir_all(&out_dir)?;
        let stem = inp
            .file_stem()
            .map(|s| s.to_string_lossy().to_string())
            .unwrap_or_else(|| "imagem".into());
        let out = out_dir.join(format!("{}_{}x.{}", stem, opts.scale, opts.format));
        let id = format!("upscale:{}", input);

View on GitHub (pinned to 8600b91f42)