{"record":{"id":"7121eceea9675328","repo":"tonhowtf/omniget","slug":"este-post-n-o-tem-m-dia-para-baixar-s-texto","errorCode":null,"errorMessage":"este post não tem mídia para baixar (é só texto)","messagePattern":"este post não tem mídia para baixar \\(é só texto\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/reddit/download.rs","lineNumber":623,"sourceCode":"        Plan::TextOnly => (\"text\", \"nenhum\", Vec::new(), String::new()),\n    };\n\n    if opts.write_info && post.is_some() {\n        let want_json = opts.info_format != \"txt\";\n        let want_txt = opts.info_format == \"txt\" || opts.info_format == \"both\";\n        if want_json {\n            let path = dest.join(format!(\"{}.json\", base));\n            std::fs::write(&path, serde_json::to_string_pretty(&info)?)?;\n            files.push(path.to_string_lossy().to_string());\n        }\n        if want_txt {\n            let path = dest.join(format!(\"{}.txt\", base));\n            std::fs::write(&path, info_txt(&info))?;\n            files.push(path.to_string_lossy().to_string());\n        }\n    }\n    if files.is_empty() {\n        return Err(anyhow!(\"este post não tem mídia para baixar (é só texto)\"));\n    }\n    report(\n        &progress,\n        ID,\n        \"done\",\n        files.len() as u64,\n        Some(files.len() as u64),\n        None,\n    );\n    Ok(DownloadResult {\n        kind: kind.to_string(),\n        source: source.to_string(),\n        files,\n        dest: dest.to_string_lossy().to_string(),\n        info,\n        log_tail,\n        used_session: fetcher.has_session(),\n    })","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/reddit/download.rs#L605-L641","documentation":"After executing the plan (video/image/gallery/text), the files vector is empty, meaning nothing was downloaded. Since the only plan that legitimately yields nothing is Plan::TextOnly, the library reports that the post is a text-only post with no downloadable media.","triggerScenarios":"run() given a self-text post (no media attachment), so the .txt info file was written but files ended up empty — actually thrown when even the text plan did not run, i.e. plans produced zero files.","commonSituations":"Text-only posts passed to a media downloader; posts where media was removed so all downloads silently failed; crossposts whose media lives on the original post.","solutions":["Check the post in a browser — if it has no image/video, this tool cannot download anything (expected behavior)","For text-only posts use the text-export path instead of media download","If the post does have media, verify the direct downloads aren't failing (look for earlier errors); media may have been removed","Try the gallery-dl fallback manually for crossposts/removed media"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check the post actually has media via Reddit JSON before calling:\nlet j: serde_json::Value = fetch_json(&post_url).await?;\nlet has_media = j[\"data\"][\"children\"][0][\"data\"][\"post_hint\"].is_string()\n    || !j[\"data\"][\"children\"][0][\"data\"][\"gallery_data\"].is_null();\nif !has_media { eprintln!(\"post is text-only; skipping download\"); }","typeGuard":"fn post_has_media(post: &serde_json::Value) -> bool {\n    post[\"post_hint\"].is_string() || !post[\"gallery_data\"].is_null()\n        || !post[\"secure_media\"].is_null() || !post[\"is_gallery\"].as_bool().unwrap_or(false)\n}","tryCatchPattern":"match run(opts).await {\n    Err(e) if e.to_string().contains(\"não tem mídia\") => {\n        // treat as success-with-nothing-to-do for text-only posts\n    }\n    other => other?,\n}","preventionTips":["Check post_hint / gallery_data in the post JSON before invoking","Skip self-text posts programmatically","For crossposts, resolve to the original post that holds the media"],"tags":["reddit","no-media","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-23T08:17:48.524Z"}