tonhowtf/omniget · error

fonte desconhecida: {}

Error message

fonte desconhecida: {}

What it means

Unknown-source guard in fetch_source(), the blocklist fetcher used by apply(): an id is accepted only if it is the built-in "microsoft" list, resolves via source_url(id) to a known blocklist, or itself looks like an http(s) URL. Any other identifier fails with this error, carrying the id in {}. It fires when apply() is asked to use a blocklist source name that is neither predefined nor a direct URL — typically a typo or a removed/renamed source id.

Solutions

  1. Use one of the built-in source ids (e.g. 'microsoft') or a full http(s) URL
  2. Fix typos in the source id
  3. Register the new source in source_url() if it should be supported
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src-tauri/omniget-core/src/core/tools/hosts_block.rs:543 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/c0d17ed8d28eecec. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/hosts_block.rs:543

            .map(|s| s.to_string_lossy().to_string())
            .unwrap_or_else(|| "hosts".into())
    ));
    std::fs::write(&dest, text).ok()?;
    Some(dest)
}

async fn fetch_source(client: &reqwest::Client, id: &str) -> anyhow::Result<Vec<String>> {
    if id == "microsoft" {
        return Ok(MICROSOFT_TELEMETRY
            .iter()
            .copied()
            .filter_map(normalize_domain)
            .collect());
    }
    let url = source_url(id)
        .map(str::to_string)
        .or_else(|| id.starts_with("http").then(|| id.to_string()))
        .ok_or_else(|| anyhow!("fonte desconhecida: {}", id))?;
    let resp = client.get(&url).send().await?;
    if !resp.status().is_success() {
        return Err(anyhow!("HTTP {}", resp.status()));
    }
    let text = resp.text().await?;
    Ok(parse_list(&text))
}

pub async fn apply(
    opts: &ApplyOptions,
    progress: &super::ProgressFn,
) -> anyhow::Result<ApplyResult> {
    let path = resolve_path(&opts.path);
    let client = super::client()?;
    let total = opts.sources.len() as u64 + 1;

    let mut lists: Vec<Vec<String>> = Vec::new();
    let mut stats: Vec<SourceStat> = Vec::new();

View on GitHub (pinned to 8600b91f42)