tonhowtf/omniget · error
escolha ao menos uma imagem
Error message
escolha ao menos uma imagem
What it means
img_bg's run_blocking collects the input image paths from opts.inputs and opts.input_dir before starting background removal. If the resulting list is empty it refuses to proceed, since removing a background from nothing is meaningless. The library throws this early validation error instead of creating an ONNX session or spawning work on empty input.
Solutions
- Populate opts.inputs with at least one image path before calling run
- Point opts.input_dir at a directory that exists and contains image files
- Check collect_inputs results (file existence, extension filters) for why inputs were dropped
Example fix
// before
BgOptions { inputs: vec![], input_dir: None, .. }
// after
BgOptions { inputs: vec!["photo.png".into()], input_dir: None, .. } Defensive patterns
Strategy: validation
Validate before calling
let files: Vec<_> = collect_inputs(&opts.inputs, &opts.input_dir);
if files.is_empty() {
return Err(anyhow!("escolha ao menos uma imagem"));
} Prevention
- Always set either inputs or input_dir before calling run
- Verify the input directory is non-empty and contains supported image extensions
- In UIs, disable the submit button until at least one file is selected
When it happens
Trigger: Calling run (via run_blocking) with an opts where both opts.inputs is empty/absent and opts.input_dir points to a nonexistent or empty directory, so collect_inputs returns an empty Vec.
Common situations: CLI/Tauri frontend launched without selecting files; input_dir typo or empty folder; user cleared the file list in the UI before submitting.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- informe um appid, um link da loja ou marque a biblioteca…
- nenhuma imagem
- escolha a pasta de destino
- nenhum link de vídeo do TikTok na entrada
- escolha a pasta de destino para organizar
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/39bb430d7e10fde8.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/img_bg.rs:413
let (ow, oh) = (img.width(), img.height());
Ok(image::imageops::resize(
&small,
ow,
oh,
FilterType::Lanczos3,
))
}
fn run_blocking(
opts: &BgOptions,
model_id: &str,
progress: &ProgressFn,
) -> anyhow::Result<BgResult> {
let params = *params_for(model_id)
.ok_or_else(|| anyhow!("o modelo {model_id} não serve para remover fundo"))?;
let files = collect_inputs(&opts.inputs, &opts.input_dir);
if files.is_empty() {
return Err(anyhow!("escolha ao menos uma imagem"));
}
let background = parse_hex_color(&opts.background)?;
let ext = resolve_format(&opts.format, background.is_some(), opts.mask_only);
let mut session = super::onnx::session_for(model_id)?;
let total = files.len() as u64;
let mut items: Vec<BgItem> = Vec::with_capacity(files.len());
let mut failed = 0usize;
for (i, path) in files.iter().enumerate() {
super::report(
progress,
TOOL_ID,
"progress",
i as u64,
Some(total),
Some(path.to_string_lossy().to_string()),
);View on GitHub (pinned to 8600b91f42)