tonhowtf/omniget · error
não abri
Error message
não abri {}: {} What it means
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.
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.
Example fix
// before
let result = run(&opts, progress)?;
// after
for p in &opts.inputs {
let path = std::path::Path::new(p);
if !path.is_file() {
eprintln!("arquivo de print não encontrado: {}", p);
return Ok(());
}
}
let result = run(&opts, progress)?; Defensive patterns
Strategy: validation
Validate before calling
let valid: Vec<_> = opts.inputs.iter()
.filter(|p| std::path::Path::new(p).is_file())
.cloned().collect();
if valid.len() != opts.inputs.len() {
eprintln!("alguns prints não existem mais; removidos da lista");
} Type guard
fn is_readable_image(path: &str) -> bool {
std::path::Path::new(path).is_file()
&& std::fs::File::open(path).is_ok()
} Try / catch
match run(&opts, progress) {
Ok(result) => handle(result),
Err(e) if e.to_string().starts_with("não abri ") => {
eprintln!("arquivo de print ilegível: {e}");
// drop the offending path and retry
}
Err(e) => return Err(e),
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "open() failed", "failed to open file", "cannot create file" — what a file open error means and how to fix it — this error's family across 42 libraries.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/a85c979bff5aa13d.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/image_stitch.rs:368
}
pub fn run(opts: &StitchOptions, progress: &ProgressFn) -> anyhow::Result<StitchResult> {
if opts.inputs.is_empty() {
return Err(anyhow!("escolha pelo menos um print"));
}
let total = opts.inputs.len() as u64;
let mut frames: Vec<RgbaImage> = Vec::with_capacity(opts.inputs.len());
for (i, path) in opts.inputs.iter().enumerate() {
super::report(
progress,
"img-stitch",
"progress",
i as u64,
Some(total),
Some(path.clone()),
);
let img = image::open(Path::new(path))
.map_err(|e| anyhow!("não abri {}: {}", path, e))?
.to_rgba8();
frames.push(img);
}
let (canvas, seams) = stitch(&frames, opts, progress)?;
let canvas = cap_width(canvas, opts.max_width);
let data = encode(&canvas, &opts.format, opts.quality)?;
let ext = if opts.format.eq_ignore_ascii_case("jpeg") || opts.format.eq_ignore_ascii_case("jpg")
{
"jpg"
} else {
"png"
};
let output = if opts.output.trim().is_empty() {
let first = Path::new(&opts.inputs[0]);
let dir = first.parent().map(|p| p.to_path_buf()).unwrap_or_default();
dir.join(format!("costura.{}", ext))View on GitHub (pinned to 8600b91f42)