{"record":{"id":"45e2665d3efe227c","repo":"tonhowtf/omniget","slug":"no-media-found-in-post-mod","errorCode":null,"errorMessage":"No media found in post","messagePattern":"No media found in post","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/platforms/instagram/mod.rs","lineNumber":539,"sourceCode":"                }\n            }\n        }\n\n        if let Some(video_url) = data.get(\"video_url\").and_then(|v| v.as_str()) {\n            return Ok(InstagramMedia::Single {\n                url: video_url.to_string(),\n                is_video: true,\n            });\n        }\n\n        if let Some(display_url) = data.get(\"display_url\").and_then(|v| v.as_str()) {\n            return Ok(InstagramMedia::Single {\n                url: display_url.to_string(),\n                is_video: false,\n            });\n        }\n\n        Err(anyhow!(\"No media found in post\"))\n    }\n\n    fn instagram_headers() -> reqwest::header::HeaderMap {\n        let mut headers = reqwest::header::HeaderMap::new();\n        headers.insert(\n            reqwest::header::REFERER,\n            \"https://www.instagram.com/\".parse().unwrap(),\n        );\n        headers.insert(\n            reqwest::header::ORIGIN,\n            \"https://www.instagram.com\".parse().unwrap(),\n        );\n        headers\n    }\n\n    fn post_url_from_title(title: &str) -> Option<String> {\n        let post_id = title.strip_prefix(\"instagram_\")?;\n        if post_id.is_empty() {","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/src/platforms/instagram/mod.rs#L521-L557","documentation":"Raised by `extract_media_from_gql` when a successfully parsed Instagram GraphQL response contains no media nodes — none of the video_url / display_url / edge_sidecar_to_children fields the function inspects are present. It signals a structurally-valid GraphQL payload that simply has no downloadable media for this post.","triggerScenarios":"Calling `extract_media_from_gql` on a GraphQL JSON object that lacks `shortcode_media` media fields: private/deleted post, a post type the extractor doesn't recognize (e.g. IGTV variants or new post types), or Instagram returning an empty/partial GraphQL payload after an API shape change.","commonSituations":"Instagram silently changes GraphQL field names (`display_url` → new key); the post was deleted between URL fetch and GraphQL call; unauthenticated GraphQL requests get a truncated response; sharing an album whose children use a new structure.","solutions":["Confirm the post is still live and public on instagram.com before retrying","Log the raw GraphQL JSON to inspect which field names changed, then update the extraction paths in `extract_media_from_gql`","Fall back to `request_embed`/`fallback_ytdlp` when GraphQL extraction returns this error","Attach authenticated cookies/session headers so Instagram returns the full GraphQL payload instead of a redacted one"],"exampleFix":"// before\nlet media = self.extract_media_from_gql(&gql_json)?;\n// after\nlet media = match self.extract_media_from_gql(&gql_json) {\n    Ok(m) => m,\n    Err(e) => {\n        tracing::warn!(\"gql extraction empty: {e:#}; trying embed\");\n        self.request_embed(&post_id).await?.into()\n    }\n};","handlingStrategy":"fallback","validationCode":"fn gql_has_media(gql: &serde_json::Value) -> bool {\n    gql[\"data\"][\"shortcode_media\"].is_object()\n        || gql[\"display_url\"].is_string()\n        || gql[\"video_url\"].is_string()\n        || gql[\"edge_sidecar_to_children\"].is_object()\n}","typeGuard":"fn is_media_present(v: &serde_json::Value) -> bool {\n    v.get(\"display_url\").is_some()\n        || v.get(\"video_url\").is_some()\n        || v.get(\"edge_sidecar_to_children\").is_some()\n}","tryCatchPattern":"match extract_media_from_gql(&gql) {\n    Ok(m) => m,\n    Err(e) if e.to_string().contains(\"No media found in post\") => {\n        tracing::warn!(\"gql payload had no media; trying embed path\");\n        extract_media_from_embed(&html)?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Verify the post is public and live before extraction; deleted/private posts yield empty GraphQL media","Persist a sample of failing GraphQL payloads to detect Instagram field renames quickly","Prefer authenticated session cookies so GraphQL responses aren't redacted","Chain GraphQL → embed → yt-dlp extraction paths so one empty source doesn't fail the job"],"tags":["instagram","graphql","scraping","empty-result"],"backgroundTag":"empty-result-set","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"}