tonhowtf/omniget · error

regra desconhecida

Error message

regra desconhecida: {}

What it means

A validation guard in apply: the requested tweak id does not match any rule produced by rules(), so there is no rule to enable or revert. The {} is the caller-supplied id — the fault is a stale, renamed, or fabricated rule identifier (e.g. from an outdated UI list).

Solutions

  1. Refresh the tweaks list and use an id that currently exists
  2. Check for typos or trailing characters in the rule id
  3. If the rule was removed in a newer version, use its replacement tweak
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-tauri/omniget-core/src/core/tools/win_tweaks.rs:602 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/d981d4029cbbae4c. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/win_tweaks.rs:602

    }
    #[cfg(not(target_os = "windows"))]
    {
        TweaksStatus {
            supported: false,
            is_admin: false,
            rules,
        }
    }
}

/// Aplica (`enable`) ou reverte uma regra. Guarda o valor anterior em
/// `<app_data>/tools/win_tweaks_backup.json` para o botão "restaurar".
#[allow(unused_mut, unused_variables)]
pub async fn apply(id: &str, enable: bool) -> anyhow::Result<Rule> {
    let mut rule = rules()
        .into_iter()
        .find(|r| r.id == id)
        .ok_or_else(|| anyhow!("regra desconhecida: {}", id))?;
    #[cfg(not(target_os = "windows"))]
    {
        let _ = enable;
        let _ = &mut rule;
        Err(anyhow!("esses ajustes so existem no Windows"))
    }
    #[cfg(target_os = "windows")]
    {
        if rule.requires_admin && !is_admin().await {
            return Err(anyhow!(
                "essa regra precisa do OmniGet aberto como administrador"
            ));
        }
        if let Some(prev) = reg_query(&rule.key, &rule.name).await {
            backup_store(&rule.id, &prev);
        }
        let target = if enable {
            rule.on.clone()

View on GitHub (pinned to 8600b91f42)