{"record":{"id":"146645130d6684fc","repo":"tauri-apps/tauri","slug":"no-data-in-parent-lib","errorCode":null,"errorMessage":"No data in parent","messagePattern":"No data in parent","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/tauri-build/src/lib.rs","lineNumber":52,"sourceCode":"mod mobile;\nmod static_vcruntime;\n\n#[cfg(feature = \"codegen\")]\n#[cfg_attr(docsrs, doc(cfg(feature = \"codegen\")))]\npub use codegen::context::CodegenContext;\n\npub use acl::{AppManifest, DefaultPermissionRule, InlinedPlugin};\n\nfn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<()> {\n  let from = from.as_ref();\n  let to = to.as_ref();\n  if !from.exists() {\n    return Err(anyhow::anyhow!(\"{:?} does not exist\", from));\n  }\n  if !from.is_file() {\n    return Err(anyhow::anyhow!(\"{:?} is not a file\", from));\n  }\n  let dest_dir = to.parent().expect(\"No data in parent\");\n  fs::create_dir_all(dest_dir)?;\n  fs::copy(from, to)?;\n  Ok(())\n}\n\nfn copy_binaries(\n  binaries: ResourcePaths,\n  target_triple: &str,\n  path: &Path,\n  package_name: Option<&str>,\n) -> Result<()> {\n  for src in binaries {\n    let src = src?;\n    println!(\"cargo:rerun-if-changed={}\", src.display());\n    let file_name = src\n      .file_name()\n      .expect(\"failed to extract external binary filename\")\n      .to_string_lossy()","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-build/src/lib.rs#L34-L70","documentation":"In tauri-build's copy_file helper, to.parent().expect(\"No data in parent\") panics when the destination path has no parent directory (i.e. it is a root-level path like \"foo\" with no directory component). The library assumes destinations always include a directory component, so this invariant is enforced with an unwrap.","triggerScenarios":"Configuring a Tauri resource, binary, or framework whose destination path has no parent directory component, e.g. mapping a file to just \"myfile\" instead of \"bin/myfile\", so copy_file is called with a parentless destination.","commonSituations":"Writing bundle resources/binaries config with bare filenames as destinations; generating destination paths programmatically and dropping the directory part; running from a context where the path was normalized to a bare name.","solutions":["Give the destination path an explicit directory, e.g. \"resources/myfile\" instead of \"myfile\"","Check tauri.conf.json bundle.resources / binaries mappings for bare filename destinations","If constructing paths in a custom build script, join the destination onto a base directory before calling into tauri-build"],"exampleFix":"// before (tauri.conf.json)\n\"resources\": [\"../assets/logo.png:logo.png\"]\n// after\n\"resources\": [\"../assets/logo.png:assets/logo.png\"]","handlingStrategy":"validation","validationCode":"// Validate destination mapping strings in tauri.conf.json before building\ncfg.bundle.resources?.forEach(r => {\n  const dest = r.includes(':') ? r.split(':')[1] : r;\n  if (!dest.includes('/')) console.warn(`resource destination '${dest}' has no parent dir; copy_file will panic`);\n});","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always give bundle resource/binary/framework destinations a directory component","Use path.join(base_dir, name) when generating destinations in build scripts","Review tauri.conf.json resource mappings after path refactors"],"tags":["build","panic","path","resources"],"backgroundTag":"internal-invariant-violation","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}