{"record":{"id":"c797fb1f2cfcecf7","repo":"tonhowtf/omniget","slug":"n-o-h-arquivo-em-andamento-nessa-pasta","errorCode":null,"errorMessage":"não há arquivo em andamento nessa pasta","messagePattern":"não há arquivo em andamento nessa pasta","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/omniget-core/src/core/tools/yt_archive.rs","lineNumber":475,"sourceCode":"\nstatic CANCEL: AtomicBool = AtomicBool::new(false);\n\n/// Pede parada depois do item que estiver rodando.\npub fn cancel() {\n    CANCEL.store(true, Ordering::SeqCst);\n}\n\nfn has_session(opts: &Options) -> bool {\n    opts.session_netscape\n        .as_ref()\n        .map(|s| !s.trim().is_empty())\n        .unwrap_or(false)\n}\n\n/// Lê o estado gravado sem tocar na rede — é o que a tela mostra ao abrir.\npub fn state(dest: &str) -> anyhow::Result<ArchiveResult> {\n    let dir = PathBuf::from(dest.trim());\n    let st = load_state(&dir).ok_or_else(|| anyhow!(\"não há arquivo em andamento nessa pasta\"))?;\n    Ok(result_of(&dir, &st, false, false))\n}\n\n/// Enumera a coleção e funde com o estado, sem baixar nada.\npub async fn scan(opts: &Options, progress: &super::ProgressFn) -> anyhow::Result<ArchiveResult> {\n    let dest = PathBuf::from(opts.dest.trim());\n    if opts.dest.trim().is_empty() {\n        return Err(anyhow!(\"escolha a pasta do arquivo\"));\n    }\n    std::fs::create_dir_all(&dest)?;\n    let mut st = enumerate(opts, &dest, progress).await?;\n    save_state(&dest, &mut st)?;\n    Ok(result_of(&dest, &st, has_session(opts), false))\n}\n\nasync fn enumerate(\n    opts: &Options,\n    dest: &Path,","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/tonhowtf/omniget/blob/8600b91f4246848bac346874daa9e61c1fc5677a/src-tauri/omniget-core/src/core/tools/yt_archive.rs#L457-L493","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the folder is the one previously chosen as the archive destination.","Start a new scan/download on the folder first (scan/run) to create the state file.","Check the directory for the state file; if it was deleted, the session cannot be resumed and must restart.","Trim/normalize the dest path before calling state."],"exampleFix":"// before\nlet res = yt_archive::state(&folder)?;\n// after\nlet res = match yt_archive::state(&folder) {\n    Ok(r) => r,\n    Err(_) => {\n        eprintln!(\"nenhuma sessão em {folder}; iniciando novo scan\");\n        yt_archive::scan(&opts, &progress).await?\n    }\n};","handlingStrategy":"fallback","validationCode":"// Rust\nlet has_state = std::path::Path::new(dest).join(\"archive_state.json\").exists(); // ajuste ao nome real do arquivo\nif !has_state {\n    eprintln!(\"pasta sem sessão anterior; inicie um novo scan\");\n}","typeGuard":null,"tryCatchPattern":"match yt_archive::state(dest) {\n    Ok(r) => r,\n    Err(e) if e.to_string().contains(\"não há arquivo em andamento\") => {\n        eprintln!(\"sem sessão anterior; rodando scan inicial\");\n        yt_archive::scan(&opts, &progress).await?\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Only call state() on folders previously used as an archive destination","Show a 'start new archive' UI state when no session exists","Avoid letting users delete the state file while a session is open","Normalize/trim dest paths before lookup"],"tags":["file-not-found","state","resume"],"backgroundTag":"file-not-found","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"}