{"record":{"id":"a8f77d9b8de3d870","repo":"tonhowtf/omniget","slug":"escolha-pelo-menos-um-print","errorCode":null,"errorMessage":"escolha pelo menos um print","messagePattern":"escolha pelo menos um print","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/image_stitch.rs","lineNumber":312,"sourceCode":"\n    let bg = super::icon_pack::parse_hex(&opts.background);\n    let mut canvas = RgbaImage::from_pixel(width, height, bg);\n    for (img, top) in drawn.iter().zip(&tops) {\n        let x = align_offset(width, img.width(), align);\n        imageops::overlay(&mut canvas, img, x, top - shift);\n    }\n    (canvas, seams)\n}\n\n/// Costura a lista já carregada. Fica separada do `run` para os testes não\n/// precisarem de arquivo em disco.\npub fn stitch(\n    frames: &[RgbaImage],\n    opts: &StitchOptions,\n    progress: &ProgressFn,\n) -> anyhow::Result<(RgbaImage, Vec<StitchSeam>)> {\n    if frames.is_empty() {\n        return Err(anyhow!(\"escolha pelo menos um print\"));\n    }\n    if opts.direction == \"horizontal\" {\n        // Girando 90° no sentido horário, a borda direita vira o rodapé e a\n        // esquerda vira o topo — exatamente o que a costura vertical espera.\n        // O eixo curto inverte junto, então o alinhamento troca de ponta.\n        let turned: Vec<RgbaImage> = frames.iter().map(imageops::rotate90).collect();\n        let align = match opts.align.as_str() {\n            \"start\" => \"end\",\n            \"end\" => \"start\",\n            other => other,\n        };\n        let (canvas, seams) = stitch_vertical(&turned, opts, align, progress);\n        Ok((imageops::rotate270(&canvas), seams))\n    } else {\n        Ok(stitch_vertical(frames, opts, &opts.align, progress))\n    }\n}\n","sourceCodeStart":294,"sourceCodeEnd":330,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/image_stitch.rs#L294-L330","documentation":"Thrown by stitch when the frames slice is empty — there are no screenshots to sew together, so no output canvas can be created. This is a fast-fail guard at the top of the public stitch() entry point, checked before any direction/overlap logic runs.","triggerScenarios":"Calling stitch(&[], &opts, &progress) directly, or via run() after upstream loading produced zero successfully decoded frames (e.g. all files failed to open and were filtered out).","commonSituations":"Glob/folder passed to the stitch wrapper matched nothing; every frame failed to decode upstream and the empty vec was passed through; a caller constructed frames programmatically and forgot to push.","solutions":["Ensure at least one decoded RgbaImage is passed to stitch; validate frames.len() >= 1 at the call site.","If loading from files, check that the loader reported successful opens and didn't silently skip all files.","Guard in the UI: require at least one selected screenshot before invoking run().","Log the frames count before stitching to catch empty-input paths early."],"exampleFix":"// before\nlet (img, seams) = image_stitch::stitch(&frames, &opts, &progress)?; // frames: vec![]\n// after\nif frames.is_empty() {\n    anyhow::bail!(\"selecione pelo menos um print antes de costurar\");\n}\nlet (img, seams) = image_stitch::stitch(&frames, &opts, &progress)?;","handlingStrategy":"validation","validationCode":"fn can_stitch(frames: &[image::RgbaImage]) -> bool { !frames.is_empty() }\n// call stitch/run only if can_stitch(&frames)","typeGuard":null,"tryCatchPattern":"match image_stitch::run(&files, &opts, &progress) {\n    Err(e) if e.to_string().contains(\"escolha pelo menos um print\") => {\n        eprintln!(\"selecione capturas antes de costurar\");\n    }\n    other => other?,\n}","preventionTips":["Require at least one screenshot in the UI before invoking stitch.","Check that the loader actually produced frames (count successful opens).","Fail fast at the call site when frames.is_empty().","Log the number of loaded frames before stitching."],"tags":["missing-input","validation","stitching","rust"],"backgroundTag":"empty-required-field","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"}