tonhowtf/omniget · error · anyhow::Error
CPS fora de 0,1 a 1000
Error message
CPS fora de 0,1 a 1000
What it means
start() validates the requested clicks-per-second against the supported range 0.1..=1000.0 and rejects values outside it, resetting RUNNING to false first. The autoclicker's timing loop cannot honor intervals outside this window, so out-of-range CPS is rejected up front.
Solutions
- Clamp cps into 0.1..=1000.0 before calling start(), e.g. opts.cps = opts.cps.clamp(0.1, 1000.0).
- Validate the CPS input in the UI (slider/spinner bounds) so out-of-range values never reach start().
- If the saved config may hold bad values, sanitize on load: map cps <= 0 or absurdly high values to sane defaults.
- Show the allowed range in the UI error/help text so users understand the limit.
Example fix
// before
let opts = ClickOptions { cps: 5000.0, ..read_config()? };
start(opts)?; // Err: CPS fora de 0,1 a 1000
// after
let mut opts = read_config()?;
opts.cps = opts.cps.clamp(0.1, 1000.0);
start(opts)?; Defensive patterns
Strategy: validation
Validate before calling
fn valid_cps(cps: f64) -> bool { (0.1..=1000.0).contains(&cps) && cps.is_finite() } Type guard
fn sanitize_click_options(mut o: ClickOptions) -> ClickOptions {
if !o.cps.is_finite() { o.cps = 10.0; }
o.cps = o.cps.clamp(0.1, 1000.0);
o
} Try / catch
match autoclick::start(opts) {
Err(e) if e.to_string().contains("CPS fora") =>
show_hint("Use CPS entre 0,1 e 1000"),
other => other?,
} Prevention
- Bound the CPS input widget to 0.1–1000 in the UI.
- Clamp cps when loading saved/imported configs.
- Reject non-finite (NaN/inf) values at deserialization time.
- Document the allowed range next to the setting.
When it happens
Trigger: Calling start() (or toggle() after configuring) with ClickOptions.cps < 0.1 (e.g. 0 or 0.05) or > 1000 (e.g. 5000), typically from deserialized UI/settings input that bypasses field validation.
Common situations: Manually editing a saved config file with cps: 0; typing a typo like 10000 in a settings field; importing settings from another tool with different limits; negative values from a buggy slider.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- trecho : passa do fim do vídeo
- escolha a pasta de destino para organizar
- informe um appid, um link da loja ou marque a biblioteca…
- pasta de origem não encontrada
- escolha a pasta da biblioteca de destino
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/964d7f77764d3977.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/autoclick.rs:107
}
}
}
fn button_of(name: &str) -> Button {
match name {
"right" => Button::Right,
"middle" => Button::Middle,
_ => Button::Left,
}
}
pub fn start(opts: ClickOptions) -> anyhow::Result<()> {
if RUNNING.swap(true, Ordering::SeqCst) {
return Err(anyhow!("ja esta rodando"));
}
if !(0.1..=1000.0).contains(&opts.cps) {
RUNNING.store(false, Ordering::SeqCst);
return Err(anyhow!("CPS fora de 0,1 a 1000"));
}
*LAST_OPTS.lock().unwrap_or_else(|e| e.into_inner()) = Some(opts.clone());
*ERROR.lock().unwrap_or_else(|e| e.into_inner()) = None;
CLICKS.store(0, Ordering::SeqCst);
*STARTED.lock().unwrap_or_else(|e| e.into_inner()) = Some(Instant::now());
std::thread::Builder::new()
.name("omniget-autoclick".into())
.spawn(move || {
let mut enigo = match Enigo::new(&Settings::default()) {
Ok(e) => e,
Err(e) => {
*ERROR.lock().unwrap_or_else(|e| e.into_inner()) = Some(format!("nao consegui controlar o mouse: {} (macOS: Ajustes → Privacidade → Acessibilidade)", e));
RUNNING.store(false, Ordering::SeqCst);
return;
}
};
if opts.start_delay > 0 {View on GitHub (pinned to 8600b91f42)