{"record":{"id":"fc122e874f5efe6d","repo":"tonhowtf/omniget","slug":"escolha-ao-menos-um-formato","errorCode":null,"errorMessage":"escolha ao menos um formato","messagePattern":"escolha ao menos um formato","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/blogs/medium.rs","lineNumber":631,"sourceCode":"    }\n    for prefix in [\"## \", \"# \", \"### \"] {\n        let head = format!(\"{}{}\", prefix, title);\n        if let Some(rest) = md.strip_prefix(&head) {\n            return rest.trim_start().to_string();\n        }\n    }\n    md.to_string()\n}\n\n// ── Execução ───────────────────────────────────────────────────────────\n\npub async fn run(opts: &Options, progress: ProgressFn) -> Result<ExportResult> {\n    let dest = opts.dest.trim();\n    if dest.is_empty() {\n        return Err(anyhow!(\"escolha a pasta de destino\"));\n    }\n    if !opts.markdown && !opts.html && !opts.json {\n        return Err(anyhow!(\"escolha ao menos um formato\"));\n    }\n    let user = normalize_user(&opts.user);\n    let root = PathBuf::from(dest);\n    std::fs::create_dir_all(&root)?;\n\n    let domains: Vec<String> = COOKIE_DOMAINS.iter().map(|d| d.to_string()).collect();\n    let fetcher = Fetcher::new(opts.delay_ms, opts.session_netscape.as_deref(), &domains)?;\n\n    let mut note: Option<String> = None;\n    let mut source = \"rss\";\n    let mut docs: Vec<PostDoc> = Vec::new();\n\n    if fetcher.has_session() {\n        match from_session(&fetcher, opts, &progress).await {\n            Ok(d) => {\n                source = \"session\";\n                docs = d;\n            }","sourceCodeStart":613,"sourceCodeEnd":649,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/blogs/medium.rs#L613-L649","documentation":"The Medium feed exporter validates its Options before doing any work. If neither markdown, html, nor json output formats are selected, there is nothing to produce, so run() fails fast with this Portuguese message instead of creating an empty export directory.","triggerScenarios":"Calling run() (or the rede_exporta_feed_de_ponta_a_ponta command) with an Options where opts.markdown, opts.html and opts.json are all false.","commonSituations":"UI state not persisted so all format checkboxes default to unchecked; a config file reset wiping format flags; programmatically constructing Options and forgetting to set any format bool.","solutions":["Set at least one of opts.markdown, opts.html or opts.json to true before calling run()","Check the exporter UI/settings so at least one output format checkbox is enabled","If building Options in code, default to markdown: true"],"exampleFix":"// before\nlet opts = Options { dest: \"/tmp/out\".into(), markdown: false, html: false, json: false, ..Default::default() };\n// after\nlet opts = Options { dest: \"/tmp/out\".into(), markdown: true, html: false, json: false, ..Default::default() };","handlingStrategy":"validation","validationCode":"if !(opts.markdown || opts.html || opts.json) {\n    return Err(anyhow!(\"escolha ao menos um formato\"));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default at least one format flag to true in Options::default()","Validate options in the UI before invoking the exporter","Write a unit test asserting run() rejects all-false format options"],"tags":["validation","config","rust"],"backgroundTag":"empty-required-field","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"}