tonhowtf/omniget · error
tabela de precos indisponivel
Error message
tabela de precos indisponivel: {} What it means
load() falls back to a network fetch when the cache is missing/stale; if that fetch fails at the transport layer (connection refused, DNS failure, timeout, TLS error), the underlying reqwest error is wrapped as "tabela de precos indisponivel: {}". It means the price table could not be obtained from either cache or network.
Solutions
- Read the wrapped inner error to distinguish DNS vs connection vs TLS failure
- Restore network connectivity or fix DNS/proxy settings
- Populate the cache file manually (place a valid JSON price table at cache_path) so load() succeeds without network
- Retry when the upstream service is back online
Example fix
// pre-seed the cache to avoid needing the network
// $XDG_DATA_HOME/omniget/pricing.json
{"gpt-4o": {"input_per_m": 2.5, "output_per_m": 10.0}} Defensive patterns
Strategy: fallback
Validate before calling
// reachability probe before calling
let reachable = reqwest::get("https://raw.githubusercontent.com").await.is_ok(); Try / catch
match pricing::search("gpt-4o", "", 10).await {
Err(e) if e.to_string().contains("indisponivel") => {
eprintln!("sem rede; use valores padrão ou cache local");
default_prices()
}
other => other?,
} Prevention
- Keep a seeded local cache of the price table for offline use
- Distinguish transport errors from HTTP-status errors in your retry policy
- Check connectivity/DNS before assuming the service is down
When it happens
Trigger: Calling info/search/price_for with an unreadable cache AND the remote pricing service being unreachable — no network, DNS failure, server down, TLS handshake failure, or connection timeout.
Common situations: Offline development machine, pricing endpoint permanently shut down, firewall blocking outbound HTTPS, expired TLS certs on the upstream host.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/4646dfdd33bd1bce.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/pricing.rs:79
Ok(resp) if resp.status().is_success() => {
let text = resp.text().await?;
let v: serde_json::Value = serde_json::from_str(&text)?;
if let Some(parent) = path.parent() {
std::fs::create_dir_all(parent)?;
}
tokio::fs::write(&path, &text).await?;
Ok(v)
}
other => {
// Sem rede: usa o que tiver em disco, mesmo velho.
if let Ok(text) = tokio::fs::read_to_string(&path).await {
if let Ok(v) = serde_json::from_str(&text) {
return Ok(v);
}
}
match other {
Ok(r) => Err(anyhow!("tabela de precos: HTTP {}", r.status())),
Err(e) => Err(anyhow!("tabela de precos indisponivel: {}", e)),
}
}
}
}
fn per_m(v: &serde_json::Value, key: &str) -> Option<f64> {
v.get(key).and_then(|x| x.as_f64()).map(|x| x * 1_000_000.0)
}
fn to_price(key: &str, v: &serde_json::Value) -> ModelPrice {
ModelPrice {
key: key.to_string(),
provider: v["litellm_provider"].as_str().unwrap_or("").to_string(),
mode: v["mode"].as_str().unwrap_or("").to_string(),
input_per_m: per_m(v, "input_cost_per_token"),
output_per_m: per_m(v, "output_cost_per_token"),
cache_read_per_m: per_m(v, "cache_read_input_token_cost"),
cache_write_per_m: per_m(v, "cache_creation_input_token_cost"),View on GitHub (pinned to 8600b91f42)