tonhowtf/omniget · error

não há arquivo em andamento nessa pasta

Error message

não há arquivo em andamento nessa pasta

What it means

state reads the persisted archive state from the destination folder without touching the network, to show the UI the current progress. If load_state finds no saved state file in the folder, it throws "não há arquivo em andamento nessa pasta". It means the folder exists but was never used by a download session (or the state file was deleted).

Solutions

  1. Verify the folder is the one previously chosen as the archive destination.
  2. Start a new scan/download on the folder first (scan/run) to create the state file.
  3. Check the directory for the state file; if it was deleted, the session cannot be resumed and must restart.
  4. Trim/normalize the dest path before calling state.

Example fix

// before
let res = yt_archive::state(&folder)?;
// after
let res = match yt_archive::state(&folder) {
    Ok(r) => r,
    Err(_) => {
        eprintln!("nenhuma sessão em {folder}; iniciando novo scan");
        yt_archive::scan(&opts, &progress).await?
    }
};
Defensive patterns

Strategy: fallback

Validate before calling

// Rust
let has_state = std::path::Path::new(dest).join("archive_state.json").exists(); // ajuste ao nome real do arquivo
if !has_state {
    eprintln!("pasta sem sessão anterior; inicie um novo scan");
}

Try / catch

match yt_archive::state(dest) {
    Ok(r) => r,
    Err(e) if e.to_string().contains("não há arquivo em andamento") => {
        eprintln!("sem sessão anterior; rodando scan inicial");
        yt_archive::scan(&opts, &progress).await?
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling state(dest) with a folder path that has no archive state file — never used for a download, state manually deleted, or the wrong/typo'd path passed.

Common situations: UI reopening on a folder the user cleared; user pointing at a fresh/empty directory; path with trailing whitespace or wrong case; app data cleaned by the user.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/c797fb1f2cfcecf7. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/yt_archive.rs:475

static CANCEL: AtomicBool = AtomicBool::new(false);

/// Pede parada depois do item que estiver rodando.
pub fn cancel() {
    CANCEL.store(true, Ordering::SeqCst);
}

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,

View on GitHub (pinned to 8600b91f42)