tonhowtf/omniget · error
Graph API
Error message
Graph API: {} What it means
graph_post is the low-level POST helper for the Instagram Graph API. After sending the form it parses the JSON response; if the payload contains an "error" object, it raises "Graph API: <message>" using the message field (or the literal "erro" when absent). This is the relay of Facebook/Instagram's structured API error into the library's anyhow error type.
Solutions
- Read the message after "Graph API: " and follow the Graph API error-code docs (e.g. code 190 = token problem, code 10 = permission)
- Refresh/regenerate the access token and confirm the instagram_content_publish permission is granted
- Verify the media URLs are publicly accessible over HTTPS and the IG account is a Business/Creator account linked to a Facebook Page
Example fix
// before
let resp = graph_post(&http, &url, &[("access_token", token)]).await?;
// after (inspect error details first)
match graph_post(&http, &url, &form).await {
Err(e) if e.to_string().starts_with("Graph API: 190") => refresh_token_and_retry(),
r => r,
} Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: verify token before publishing
let ok = http.get(format!("{GRAPH}/{ig_user}?fields=id&access_token={token}"))
.send().await?.json::<Value>().await?
.get("error").is_none();
if !ok { return Err("token/credenciais inválidas antes de publicar"); } Try / catch
match publish_graph(&auth, &req).await {
Err(e) if e.to_string().contains("Graph API: 190") => refresh_token_and_retry().await,
Err(e) => Err(e),
Ok(r) => Ok(r),
} Prevention
- Refresh long-lived tokens before they expire and store expiry timestamps
- Request the instagram_content_publish permission during OAuth
- Pre-check media URLs are publicly reachable (HEAD 200) before publishing
When it happens
Trigger: Any POST made by graph_post (called from publish_graph, e.g. POST {GRAPH}/{user}/media or /media_publish) where Instagram returns 200 with an "error" JSON object — expired/invalid access token, missing permissions (instagram_content_publish), unsupported media URL, rate limiting.
Common situations: Long-lived token expired or revoked; app not in production/live mode so publishing is blocked; page connected account misconfigured; media URL not publicly reachable so Instagram rejects it.
Related errors
- o container falhou
- a API oficial so aceita URLs publicas (https://…) para os…
- agendamento sem token da API
- download falhou: HTTP
- Failed to add torrent
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/40c90d3db2f0a3f3.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/instagram/publish.rs:549
// ── API oficial (Graph) ──────────────────────────────────────────────────
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct GraphAuth {
pub access_token: String,
pub ig_user_id: String,
}
const GRAPH: &str = "https://graph.facebook.com/v21.0";
async fn graph_post(
http: &reqwest::Client,
url: &str,
form: &[(&str, String)],
) -> anyhow::Result<Value> {
let resp = http.post(url).form(form).send().await?;
let json: Value = resp.json().await?;
if let Some(err) = json.get("error") {
return Err(anyhow!(
"Graph API: {}",
err.get("message")
.and_then(|m| m.as_str())
.unwrap_or("erro")
));
}
Ok(json)
}
async fn graph_get(http: &reqwest::Client, url: &str) -> anyhow::Result<Value> {
let json: Value = http.get(url).send().await?.json().await?;
if let Some(err) = json.get("error") {
return Err(anyhow!(
"Graph API: {}",
err.get("message")
.and_then(|m| m.as_str())
.unwrap_or("erro")
));View on GitHub (pinned to 8600b91f42)