tonhowtf/omniget · error

o Instagram demorou demais para processar a midia

Error message

o Instagram demorou demais para processar a midia

What it means

wait_container loops polling the container status every 5 seconds; if the loop exhausts its bounded number of iterations without reaching FINISHED, it gives up with "o Instagram demorou demais para processar a midia" (Instagram took too long to process the media). It is a client-side timeout on the async container-processing pipeline.

Solutions

  1. Retry the publish later — processing delay is often transient on Instagram's side
  2. Reduce video size/duration and re-encode with Instagram-recommended settings so transcoding finishes faster
  3. If delays are routine, raise the polling budget/timeout in wait_container (more iterations) while keeping the 5s interval

Example fix

// before
for _ in 0..N_POLLS { ... } // too few for long videos
// after
for _ in 0..(N_POLLS * 4) {
    // same 5s poll loop; longer overall budget
}
Defensive patterns

Strategy: retry

Validate before calling

// prefer smaller, pre-encoded assets so processing completes within the polling budget
assert!(file_size_mb <= 100.0 && duration_secs <= 90.0);

Try / catch

match wait_container(&http, &id, &token).await {
    Err(e) if e.to_string().contains("demorou demais") => {
        tokio::time::sleep(Duration::from_secs(60)).await;
        wait_container(&http, &id, &token).await // retry poll once more
    }
    r => r,
}

Prevention

When it happens

Trigger: publish_graph creates a video container whose status_code stays in IN_PROGRESS for the full polling budget of wait_container (5-second sleeps until the loop ends).

Common situations: Large/slow-transcoding videos during Instagram peak load; container stuck in PROCESSING due to an overloaded or mis-encoded source file.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/972d9fc39fa39d6c. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/instagram/publish.rs:588

}

async fn wait_container(http: &reqwest::Client, id: &str, token: &str) -> anyhow::Result<()> {
    for _ in 0..40 {
        let st = graph_get(
            http,
            &format!(
                "{}/{}?fields=status_code,status&access_token={}",
                GRAPH, id, token
            ),
        )
        .await?;
        match s(&st, "status_code").as_str() {
            "FINISHED" => return Ok(()),
            "ERROR" | "EXPIRED" => return Err(anyhow!("o container falhou: {}", s(&st, "status"))),
            _ => tokio::time::sleep(std::time::Duration::from_secs(5)).await,
        }
    }
    Err(anyhow!("o Instagram demorou demais para processar a midia"))
}

/// Publica pela API oficial. `req.files` são URLs públicas.
pub async fn publish_graph(
    auth: &GraphAuth,
    req: &PublishRequest,
    progress: &super::super::ProgressFn,
    job: &str,
) -> anyhow::Result<PublishResult> {
    let id = format!("ig:{}", job);
    let http = super::super::client()?;
    let token = auth.access_token.trim().to_string();
    let user = auth.ig_user_id.trim().to_string();
    if token.is_empty() || user.is_empty() {
        return Err(anyhow!("informe o token e o ID da conta do Instagram"));
    }
    if req.files.is_empty() || !req.files.iter().all(|f| f.starts_with("http")) {
        return Err(anyhow!(

View on GitHub (pinned to 8600b91f42)