{"record":{"id":"a85c979bff5aa13d","repo":"tonhowtf/omniget","slug":"n-o-abri-image-stitch","errorCode":null,"errorMessage":"não abri {}: {}","messagePattern":"não abri (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/image_stitch.rs","lineNumber":368,"sourceCode":"}\n\npub fn run(opts: &StitchOptions, progress: &ProgressFn) -> anyhow::Result<StitchResult> {\n    if opts.inputs.is_empty() {\n        return Err(anyhow!(\"escolha pelo menos um print\"));\n    }\n    let total = opts.inputs.len() as u64;\n    let mut frames: Vec<RgbaImage> = Vec::with_capacity(opts.inputs.len());\n    for (i, path) in opts.inputs.iter().enumerate() {\n        super::report(\n            progress,\n            \"img-stitch\",\n            \"progress\",\n            i as u64,\n            Some(total),\n            Some(path.clone()),\n        );\n        let img = image::open(Path::new(path))\n            .map_err(|e| anyhow!(\"não abri {}: {}\", path, e))?\n            .to_rgba8();\n        frames.push(img);\n    }\n\n    let (canvas, seams) = stitch(&frames, opts, progress)?;\n    let canvas = cap_width(canvas, opts.max_width);\n    let data = encode(&canvas, &opts.format, opts.quality)?;\n\n    let ext = if opts.format.eq_ignore_ascii_case(\"jpeg\") || opts.format.eq_ignore_ascii_case(\"jpg\")\n    {\n        \"jpg\"\n    } else {\n        \"png\"\n    };\n    let output = if opts.output.trim().is_empty() {\n        let first = Path::new(&opts.inputs[0]);\n        let dir = first.parent().map(|p| p.to_path_buf()).unwrap_or_default();\n        dir.join(format!(\"costura.{}\", ext))","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/image_stitch.rs#L350-L386","documentation":"Raised in `run` when `image::open` fails to read one of the input files from disk; the error includes the path and the underlying image-crate error ('não abri {path}: {e}'). It means the file could not be opened or decoded as an image before conversion to RGBA8.","triggerScenarios":"Calling `run` with an `inputs` entry whose path does not exist, is a directory, has unsupported/unknown extension or corrupted content, or is unreadable due to permissions.","commonSituations":"Stale file paths (screenshot deleted or moved before stitching); user selects a non-image file; path with wrong Unicode/escaping; file still being written by another process.","solutions":["Verify each path in `opts.inputs` exists and is a readable file before calling run (std::path::Path::is_file).","Confirm the file is a supported image format (PNG/JPEG/etc.) and not truncated — re-capture the screenshot if corrupted.","Check file permissions and that no other process holds an exclusive lock on the file."],"exampleFix":"// before\nlet result = run(&opts, progress)?;\n// after\nfor p in &opts.inputs {\n    let path = std::path::Path::new(p);\n    if !path.is_file() {\n        eprintln!(\"arquivo de print não encontrado: {}\", p);\n        return Ok(());\n    }\n}\nlet result = run(&opts, progress)?;","handlingStrategy":"validation","validationCode":"let valid: Vec<_> = opts.inputs.iter()\n    .filter(|p| std::path::Path::new(p).is_file())\n    .cloned().collect();\nif valid.len() != opts.inputs.len() {\n    eprintln!(\"alguns prints não existem mais; removidos da lista\");\n}","typeGuard":"fn is_readable_image(path: &str) -> bool {\n    std::path::Path::new(path).is_file()\n        && std::fs::File::open(path).is_ok()\n}","tryCatchPattern":"match run(&opts, progress) {\n    Ok(result) => handle(result),\n    Err(e) if e.to_string().starts_with(\"não abri \") => {\n        eprintln!(\"arquivo de print ilegível: {e}\");\n        // drop the offending path and retry\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Re-validate input paths at the moment the action runs, not when selected","Show file existence indicators in the selection list","Handle files still being written by waiting for write completion or checking mtime stability"],"tags":["file-io","image-decoding","rust","file-not-found"],"backgroundTag":"file-open-failed","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"}