{"record":{"id":"ee468c98be321853","repo":"jely2002/youtube-dl-gui","slug":"selected-entry-vanished-during-extraction","errorCode":null,"errorMessage":"selected entry vanished during extraction","messagePattern":"selected entry vanished during extraction","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/binaries/binaries_extractor.rs","lineNumber":265,"sourceCode":"      .and_then(|n| n.to_str())\n      .unwrap_or(tool_name.as_str());\n    let tmp_out = out_dir.join(format!(\"{base}.tmp\"));\n    ensure_parent(&tmp_out)?;\n\n    for e in tar.entries()? {\n      let mut e = e?;\n      if !e.header().entry_type().is_file() {\n        continue;\n      }\n      if e.path()?.as_ref() == chosen_path {\n        e.unpack(&tmp_out)?;\n        atomic_file_replace(&tmp_out, &canonical)?;\n        return Ok(canonical);\n      }\n    }\n\n    Err(\n      io::Error::new(\n        io::ErrorKind::NotFound,\n        \"selected entry vanished during extraction\",\n      )\n      .into(),\n    )\n  })\n  .await?\n}\n\npub async fn extract_zip_bundle(\n  archive: &Path,\n  out_parent: &Path,\n  final_folder_name: Option<&str>,\n  entry_relative: &Path,\n  rename_entry_to: Option<&str>,\n) -> Result<(PathBuf, PathBuf), ExtractError> {\n  let archive = archive.to_owned();\n  let out_parent = out_parent.to_owned();","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/jely2002/youtube-dl-gui/blob/c402ee39c0eabab68934c48f8b787ff37a1577b0/src-tauri/src/binaries/binaries_extractor.rs#L247-L283","documentation":"extract_tar_bz2 unpacks an archive looking for a selected entry; if iteration finishes without ever matching/producing that entry, it returns an io::Error with ErrorKind::NotFound and the message 'selected entry vanished during extraction'. It is a NotFound guard ensuring the expected artifact actually existed in the archive.","triggerScenarios":"The expected binary entry is absent from the downloaded .tar.bz2 — checksum verified but the archive layout changed upstream, the target path filter never matches (renamed entry/path prefix change), or the archive is truncated after the entry stream was skipped.","commonSituations":"Upstream release renamed the binary or reorganized archive directories; a partially downloaded/interrupted archive; extracting with a hardcoded path that no longer exists in the new version of the artifact.","solutions":["Log the archive's actual entry names during extraction and compare with the expected path to find the rename.","Update the expected entry path/pattern to match the upstream archive layout for the new version.","Re-download the archive and re-verify its checksum to rule out truncation/corruption.","Pin the artifact version whose archive layout matches the extractor, or make matching tolerant (match by basename)."],"exampleFix":"// before\nif entry_path == expected_path { extract(entry)?; }\n// after\nif entry_path == expected_path\n  || entry_path.ends_with(expected_path.rsplit('/').next().unwrap()) {\n  extract(entry)?;\n}","handlingStrategy":"validation","validationCode":"let found = false;\nfor entry in archive.entries()? {\n  let path = entry?.path()?.to_string_lossy().to_string();\n  if path == expected_path { found = true; break; }\n}\nif (!found) { return Err(/* expected entry not present; inspect archive layout */); }","typeGuard":"fn contains_entry<R: Read + Seek>(ar: &mut tar::Archive<R>, want: &str) -> bool {\n  ar.entries().map(|e| e.unwrap().path().unwrap() == Path::new(want)).any(|ok| ok)\n}","tryCatchPattern":"match extract_tar_bz2(...).await {\n  Ok(path) => path,\n  Err(e) if e.to_string().contains(\"selected entry vanished\") => {\n    eprintln!(\"expected entry missing; dumping archive layout\");\n    // re-download or update expected path\n    Err(e)\n  }\n  Err(e) => Err(e),\n}","preventionTips":["Verify the archive checksum before extraction and re-download on failure.","Test the extractor against every upstream artifact version you support.","Match entries by basename or a glob instead of a hardcoded full path.","Log all entry names when the expected one is missing to speed up diagnosis."],"tags":["rust","archive-extraction","tar","not-found"],"backgroundTag":"file-not-found","analyzedSha":"c402ee39c0eabab68934c48f8b787ff37a1577b0","analyzedAt":"2026-09-12T02:01:12.452Z","contentChangedAt":"2026-09-12T02:01:12.452Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}