{"record":{"id":"ed700fabe84119d2","repo":"tonhowtf/omniget","slug":"o-container-falhou","errorCode":null,"errorMessage":"o container falhou: {}","messagePattern":"o container falhou: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/instagram/publish.rs","lineNumber":584,"sourceCode":"                .unwrap_or(\"erro\")\n        ));\n    }\n    Ok(json)\n}\n\nasync fn wait_container(http: &reqwest::Client, id: &str, token: &str) -> anyhow::Result<()> {\n    for _ in 0..40 {\n        let st = graph_get(\n            http,\n            &format!(\n                \"{}/{}?fields=status_code,status&access_token={}\",\n                GRAPH, id, token\n            ),\n        )\n        .await?;\n        match s(&st, \"status_code\").as_str() {\n            \"FINISHED\" => return Ok(()),\n            \"ERROR\" | \"EXPIRED\" => return Err(anyhow!(\"o container falhou: {}\", s(&st, \"status\"))),\n            _ => tokio::time::sleep(std::time::Duration::from_secs(5)).await,\n        }\n    }\n    Err(anyhow!(\"o Instagram demorou demais para processar a midia\"))\n}\n\n/// Publica pela API oficial. `req.files` são URLs públicas.\npub async fn publish_graph(\n    auth: &GraphAuth,\n    req: &PublishRequest,\n    progress: &super::super::ProgressFn,\n    job: &str,\n) -> anyhow::Result<PublishResult> {\n    let id = format!(\"ig:{}\", job);\n    let http = super::super::client()?;\n    let token = auth.access_token.trim().to_string();\n    let user = auth.ig_user_id.trim().to_string();\n    if token.is_empty() || user.is_empty() {","sourceCodeStart":566,"sourceCodeEnd":602,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/instagram/publish.rs#L566-L602","documentation":"wait_container polls a media container's status_code until it finishes. If the container reports ERROR or EXPIRED, publishing can never proceed, so the helper aborts with \"o container falhou: <status>\" including the container's descriptive status field. This means Instagram rejected the uploaded container itself, not the final publish call.","triggerScenarios":"During publish_graph, a container created via POST /media reaches status_code ERROR or EXPIRED while being polled every 5 seconds — e.g. a video that fails Instagram's transcoding/validation or a container left unpublished too long.","commonSituations":"Video exceeds Instagram's specs (duration, aspect ratio, codec); source URL returned 403/404 during container processing; container created but media_publish delayed beyond its expiry.","solutions":["Read the included status string to see Instagram's reason (e.g. \"Video file is invalid\")","Re-encode the video to Instagram-recommended specs (MP4/H.264, AAC, within duration limits) and retry","Ensure the source URL stays publicly reachable and publish the container promptly after creation"],"exampleFix":"// before\nlet container = create_container(url).await?;\ntokio::time::sleep(Duration::from_secs(3600)).await; // container expired\nwait_container(&http, &container, &token).await?; // Err: o container falhou: Expired\n// after\nlet container = create_container(url).await?;\nwait_container(&http, &container, &token).await?; // poll immediately\npublish(&container).await?;","handlingStrategy":"validation","validationCode":"// validate video against Instagram specs before creating a container\nassert!(duration_secs <= 90.0 && width % 4 == 0 && height % 4 == 0);\nassert!(head_request(url).status == 200, \"source URL must be publicly reachable\");","typeGuard":null,"tryCatchPattern":"match wait_container(&http, &id, &token).await {\n    Err(e) if e.to_string().contains(\"o container falhou\") => {\n        log::error!(\"container rejected: {e}; re-encode media and retry\");\n        reencode_and_recreate_container().await\n    }\n    r => r,\n}","preventionTips":["Validate media against Instagram's specs (codec, duration, aspect ratio) before upload","Publish the container immediately after it finishes processing to avoid EXPIRED","Ensure source URLs stay live for the whole processing window"],"tags":["instagram","graph-api","media-container"],"backgroundTag":"upstream-api-error","analyzedSha":"8600b91f4246848bac346874daa9e61c1fc5677a","analyzedAt":"2026-09-12T14:29:19.317Z","contentChangedAt":"2026-09-12T14:29:19.317Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}