tonhowtf/omniget · error
não foi possível ler
Error message
não foi possível ler {} What it means
Sentinel error returned after `get_json` exhausts all TRIES attempts: every attempt ended in a transport-level error (connection reset, DNS failure, timeout) rather than an HTTP status response. The message simply reports that the URL could not be fetched at all.
Solutions
- Verify network connectivity and DNS resolution for the target host (curl the URL manually)
- Check proxy/firewall/TLS settings that might block outbound HTTPS to reddit.com
- Increase TRIES or the initial backoff if on a flaky connection
- Log the underlying request error (currently discarded with `let _ = e`) to see the real cause
Example fix
// before
Err(e) if attempt < TRIES => { tokio::time::sleep(wait).await; wait *= 2; let _ = e; }
// after
Err(e) if attempt < TRIES => { tokio::time::sleep(wait).await; wait *= 2; tracing::warn!("tentativa {}: {}", attempt, e); } Defensive patterns
Strategy: retry
Validate before calling
// check connectivity before the call
if std::net::TcpStream::connect("reddit.com:443").is_err() {
anyhow::bail!("sem conexão de rede");
} Try / catch
match fetcher.get_json(&url).await {
Ok(v) => v,
Err(e) if e.to_string().starts_with("não foi possível ler") => {
// transport failed on every attempt; retry later or fail gracefully
eprintln!("rede indisponível: {}", e);
return Err(e);
}
Err(e) => return Err(e),
} Prevention
- Verify network/DNS/TLS connectivity to reddit.com before batch runs
- Increase TRIES and initial backoff for flaky networks
- Fix the code that discards the underlying error (`let _ = e`) so the real cause is logged
- Run behind a reliable egress (no silent proxy/firewall drops)
When it happens
Trigger: All retry attempts in get_json return Err from the underlying HTTP client (e.g. reqwest) — connection refused/reset, DNS resolution failure, TLS errors, or request timeouts — so the loop falls through to the final `Err(anyhow!("não foi possível ler {}", url))` at src-tauri/omniget-core/src/core/tools/reddit/mod.rs:469.
Common situations: No network access or offline machine, DNS misconfiguration, firewall/proxy blocking reddit.com, TLS certificate problems, or Reddit dropping connections from abusive clients.
Related errors
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/459fd7fd389e90f3.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/reddit/mod.rs:469
));
}
Ok(r) if r.status().as_u16() == 404 => {
return Err(anyhow!(
"post não encontrado (apagado, privado ou id errado)"
));
}
Ok(r) => {
return Err(anyhow!("HTTP {} em {}", r.status(), url));
}
Err(e) if attempt < TRIES => {
tokio::time::sleep(wait).await;
wait *= 2;
let _ = e;
}
Err(e) => return Err(e.into()),
}
}
Err(anyhow!("não foi possível ler {}", url))
}
/// Segue os redirecionamentos de um link curto e devolve a URL final.
pub async fn resolve(&self, url: &str) -> Result<String> {
self.pace().await;
self.requests.fetch_add(1, Ordering::Relaxed);
let r = self.client.get(url).send().await?;
Ok(r.url().to_string())
}
}
/// Data legível a partir do `created_utc` do Reddit.
pub fn fmt_utc(ts: f64) -> String {
chrono::DateTime::from_timestamp(ts as i64, 0)
.map(|d| d.format("%Y-%m-%d %H:%M UTC").to_string())
.unwrap_or_default()
}
View on GitHub (pinned to 8600b91f42)