tonhowtf/omniget · error
escolha a pasta do arquivo
Error message
escolha a pasta do arquivo
What it means
scan validates that opts.dest names a folder before enumerating the collection. If dest is empty (or only whitespace), it throws "escolha a pasta do arquivo". This is an upfront input guard so yt-dlp never runs without a target directory.
Solutions
- Set opts.dest to a valid writable folder path before calling scan.
- In the UI, disable the enumerate action until a folder is chosen.
- Trim and validate the path in the frontend before invoking the command.
- If dest comes from config/settings, provide a default download directory.
Example fix
// before
let res = yt_archive::scan(&opts, &progress).await?;
// after
if opts.dest.trim().is_empty() {
eprintln!("selecione uma pasta de destino antes de enumerar");
return Ok(());
}
let res = yt_archive::scan(&opts, &progress).await?; Defensive patterns
Strategy: validation
Validate before calling
// Rust
let dest = opts.dest.trim();
if dest.is_empty() {
return Err(anyhow!("selecione a pasta do arquivo antes de enumerar"));
}
if !std::path::Path::new(dest).is_dir() {
std::fs::create_dir_all(dest)?;
} Try / catch
match yt_archive::scan(&opts, &progress).await {
Ok(r) => r,
Err(e) if e.to_string().contains("escolha a pasta") => {
eprintln!("pasta de destino não definida");
prompt_user_for_folder()
}
Err(e) => return Err(e),
} Prevention
- Validate dest in the UI before enabling the enumerate action
- Provide a default download directory in settings
- Trim paths coming from forms/config to avoid whitespace-only values
- Ensure the Options struct is fully populated in tests and callers
When it happens
Trigger: Calling scan (e.g. from the live_yt_archive_enumerates_a_public_playlist flow or the UI) with Options.dest set to "" or whitespace only.
Common situations: User clicking enumerate before picking a folder in the UI; frontend passing an unset/unbound form field; tests constructing Options without dest.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- formato desconhecido
- escolha a pasta de destino
- escolha a pasta de destino
- escolha a pasta de destino
- No valid cookies found in file (expected Netscape format)
AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12).
Data as JSON: /api/errors/85157a9e06cc300f.
Report an issue: GitHub.
Appendix: source
Thrown at src-tauri/omniget-core/src/core/tools/yt_archive.rs:483
fn has_session(opts: &Options) -> bool {
opts.session_netscape
.as_ref()
.map(|s| !s.trim().is_empty())
.unwrap_or(false)
}
/// Lê o estado gravado sem tocar na rede — é o que a tela mostra ao abrir.
pub fn state(dest: &str) -> anyhow::Result<ArchiveResult> {
let dir = PathBuf::from(dest.trim());
let st = load_state(&dir).ok_or_else(|| anyhow!("não há arquivo em andamento nessa pasta"))?;
Ok(result_of(&dir, &st, false, false))
}
/// Enumera a coleção e funde com o estado, sem baixar nada.
pub async fn scan(opts: &Options, progress: &super::ProgressFn) -> anyhow::Result<ArchiveResult> {
let dest = PathBuf::from(opts.dest.trim());
if opts.dest.trim().is_empty() {
return Err(anyhow!("escolha a pasta do arquivo"));
}
std::fs::create_dir_all(&dest)?;
let mut st = enumerate(opts, &dest, progress).await?;
save_state(&dest, &mut st)?;
Ok(result_of(&dest, &st, has_session(opts), false))
}
async fn enumerate(
opts: &Options,
dest: &Path,
progress: &super::ProgressFn,
) -> anyhow::Result<ArchiveState> {
super::report(
progress,
ID,
"progress",
0,
None,View on GitHub (pinned to 8600b91f42)