tauri-apps/tauri · critical

No data in parent

Error message

No data in parent

What it means

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.

Solutions

  1. Give the destination path an explicit directory, e.g. "resources/myfile" instead of "myfile"
  2. Check tauri.conf.json bundle.resources / binaries mappings for bare filename destinations
  3. If constructing paths in a custom build script, join the destination onto a base directory before calling into tauri-build

Example fix

// before (tauri.conf.json)
"resources": ["../assets/logo.png:logo.png"]
// after
"resources": ["../assets/logo.png:assets/logo.png"]
Defensive patterns

Strategy: validation

Validate before calling

// Validate destination mapping strings in tauri.conf.json before building
cfg.bundle.resources?.forEach(r => {
  const dest = r.includes(':') ? r.split(':')[1] : r;
  if (!dest.includes('/')) console.warn(`resource destination '${dest}' has no parent dir; copy_file will panic`);
});

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of tauri-apps/tauri@460ec35447 (2026-09-18). Data as JSON: /api/errors/146645130d6684fc. Report an issue: GitHub.

Appendix: source

Thrown at crates/tauri-build/src/lib.rs:52

mod mobile;
mod static_vcruntime;

#[cfg(feature = "codegen")]
#[cfg_attr(docsrs, doc(cfg(feature = "codegen")))]
pub use codegen::context::CodegenContext;

pub use acl::{AppManifest, DefaultPermissionRule, InlinedPlugin};

fn copy_file(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<()> {
  let from = from.as_ref();
  let to = to.as_ref();
  if !from.exists() {
    return Err(anyhow::anyhow!("{:?} does not exist", from));
  }
  if !from.is_file() {
    return Err(anyhow::anyhow!("{:?} is not a file", from));
  }
  let dest_dir = to.parent().expect("No data in parent");
  fs::create_dir_all(dest_dir)?;
  fs::copy(from, to)?;
  Ok(())
}

fn copy_binaries(
  binaries: ResourcePaths,
  target_triple: &str,
  path: &Path,
  package_name: Option<&str>,
) -> Result<()> {
  for src in binaries {
    let src = src?;
    println!("cargo:rerun-if-changed={}", src.display());
    let file_name = src
      .file_name()
      .expect("failed to extract external binary filename")
      .to_string_lossy()

View on GitHub (pinned to 460ec35447)