tonhowtf/omniget · error · anyhow::Error
escolha ao menos um formato
Error message
escolha ao menos um formato
What it means
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.
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
Example fix
// before
let opts = Options { dest: "/tmp/out".into(), markdown: false, html: false, json: false, ..Default::default() };
// after
let opts = Options { dest: "/tmp/out".into(), markdown: true, html: false, json: false, ..Default::default() }; Defensive patterns
Strategy: validation
Validate before calling
if !(opts.markdown || opts.html || opts.json) {
return Err(anyhow!("escolha ao menos um formato"));
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- escolha a pasta de destino para organizar
- informe um appid, um link da loja ou marque a biblioteca…
- pasta de origem não encontrada
- escolha a pasta da biblioteca de destino
- external_data_cache: plugin_id must not be empty
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/fc122e874f5efe6d.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/blogs/medium.rs:631
}
for prefix in ["## ", "# ", "### "] {
let head = format!("{}{}", prefix, title);
if let Some(rest) = md.strip_prefix(&head) {
return rest.trim_start().to_string();
}
}
md.to_string()
}
// ── Execução ───────────────────────────────────────────────────────────
pub async fn run(opts: &Options, progress: ProgressFn) -> Result<ExportResult> {
let dest = opts.dest.trim();
if dest.is_empty() {
return Err(anyhow!("escolha a pasta de destino"));
}
if !opts.markdown && !opts.html && !opts.json {
return Err(anyhow!("escolha ao menos um formato"));
}
let user = normalize_user(&opts.user);
let root = PathBuf::from(dest);
std::fs::create_dir_all(&root)?;
let domains: Vec<String> = COOKIE_DOMAINS.iter().map(|d| d.to_string()).collect();
let fetcher = Fetcher::new(opts.delay_ms, opts.session_netscape.as_deref(), &domains)?;
let mut note: Option<String> = None;
let mut source = "rss";
let mut docs: Vec<PostDoc> = Vec::new();
if fetcher.has_session() {
match from_session(&fetcher, opts, &progress).await {
Ok(d) => {
source = "session";
docs = d;
}View on GitHub (pinned to 8600b91f42)