tonhowtf/omniget · error
e.to_string()
Error message
e.to_string()
What it means
map_err converts an Instagram-specific IgError into an anyhow::Error by stringifying it with e.to_string(). It is a generic error-conversion boundary used by the Instagram tooling in omniget-core; the message you see is just the Display impl of the underlying IgError variant.
Solutions
- Inspect the stringified message to identify the underlying IgError variant (auth vs network vs Other)
- Re-authenticate or refresh Instagram session credentials if the message indicates auth failure
- Retry transient network failures; check connectivity
- If the message is an upstream Instagram error, log the full string and check Instagram API changes
Example fix
// before anyhow!(e.to_string()) // after (preserve source chain for debugging) anyhow::Error::msg(e.to_string())
Defensive patterns
Strategy: try-catch
Try / catch
match result { Err(e) => { log::error!("instagram: {e}"); if is_auth_error(&e) { reauth()?; } } , Ok(v) => v } Prevention
- Keep session cookies/credentials fresh
- Log the full stringified IgError, not just a generic message
- Distinguish retryable (network) from permanent (auth/media) errors
When it happens
Trigger: Any call path in the instagram module that maps an IgError through map_err (e.g. HTTP failures, auth failures, JSON errors from Instagram responses bubbling up through publish/upload helpers).
Common situations: Expired Instagram session/cookies, Instagram returning an unexpected response, network failure during an upload, or an IgError::Other carrying an upstream message.
Related errors
- e.to_string()
- No downloadable media found for this tweet (it may be…
- Download cancelado
- external_data_cache: plugin_id must not be empty
- external_data_cache: namespace must not be empty
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/797469a91dd119ad.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/instagram/mod.rs:877
Some(Value::Number(n)) => n.to_string(),
_ => String::new(),
}
}
pub(crate) fn u(v: &Value, key: &str) -> u64 {
match v.get(key) {
Some(Value::Number(n)) => n.as_u64().unwrap_or(0),
Some(Value::String(x)) => x.parse().unwrap_or(0),
_ => 0,
}
}
pub(crate) fn b(v: &Value, key: &str) -> bool {
v.get(key).and_then(|x| x.as_bool()).unwrap_or(false)
}
pub fn map_err(e: IgError) -> anyhow::Error {
anyhow!(e.to_string())
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn shortcode_roundtrip() {
assert_eq!(shortcode_to_pk("B89prebFBcw"), Some(2251138696266127152));
assert_eq!(pk_to_shortcode(2251138696266127152), "B89prebFBcw");
assert_eq!(shortcode_to_pk("Dc30nJeRKKz"), Some(3978880184454783667));
}
#[test]
fn parses_targets() {
assert_eq!(
parse_target("https://www.instagram.com/p/B89prebFBcw/?igsh=abc"),
IgTarget::Post {View on GitHub (pinned to 8600b91f42)