tauri-apps/tauri · error
Path has no file_name
Error message
Path has no file_name
What it means
On macOS the updater tar is created with append_dir_all under the .app directory's file_name. src_dir.file_name() is None only when the .app bundle path is a root or ends with '..', so this is an invariant on the computed bundle path rather than a config check.
Source
Thrown at crates/tauri-bundler/src/bundle/updater_bundle.rs:249
fn create_tar(src_dir: &Path, dest_path: &Path) -> crate::Result<PathBuf> {
use flate2::{write::GzEncoder, Compression};
let dest_file = fs_utils::create_file(dest_path)?;
let gzip_encoder = GzEncoder::new(dest_file, Compression::default());
let gzip_encoder = create_tar_from_src(src_dir, gzip_encoder)?;
let mut dest_file = gzip_encoder.finish()?;
dest_file.flush()?;
Ok(dest_path.to_owned())
}
#[cfg(target_os = "macos")]
fn create_tar_from_src<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> crate::Result<W> {
let src_dir = src_dir.as_ref();
let mut builder = tar::Builder::new(dest_file);
builder.follow_symlinks(false);
builder.append_dir_all(src_dir.file_name().expect("Path has no file_name"), src_dir)?;
builder.into_inner().map_err(Into::into)
}
#[cfg(target_os = "linux")]
fn create_tar_from_src<P: AsRef<Path>, W: Write>(src_dir: P, dest_file: W) -> crate::Result<W> {
let src_dir = src_dir.as_ref();
let mut tar_builder = tar::Builder::new(dest_file);
// validate source type
let file_type = fs::metadata(src_dir).expect("Can't read source directory");
// if it's a file don't need to walkdir
if file_type.is_file() {
let mut src_file = fs::File::open(src_dir)?;
let file_name = src_dir
.file_name()
.expect("Can't extract file name from path");
tar_builder.append_file(file_name, &mut src_file)?;View on GitHub (pinned to 52e4b6e71d)
Solutions
- Re-run from a clean target with default bundle settings
- Verify productName in tauri.conf.json is a normal, non-empty, path-safe name
- Report upstream with the config if reproducible
Defensive patterns
Strategy: validation
Validate before calling
// before updater bundling, the .app path must keep a file-name component
let app = std::path::Path::new("target/release/bundle/macos/MyApp.app");
if app.file_name().is_none() { anyhow::bail!("computed .app path has no file name: {}", app.display()); } Type guard
const isSafeName = (s) => typeof s === 'string' && s.length > 0 && !s.includes('/') && !s.includes('..'); Prevention
- Keep productName a normal non-empty, path-safe value
- Avoid custom tooling that rewrites bundle output paths after the bundler computes them
When it happens
Trigger: tauri build with createUpdaterArtifacts where the computed path to the .app ends without a file-name component — e.g. productName resolving to '..'-like values; not hit with normal configurations.
Common situations: Edge-case configs or custom path overrides; effectively unreachable for stock projects.
Related errors
- No data in parent
- Can't extract file name from path
- Can't read source directory
- Failed to chmod script
- Could not get icon filename
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/604a8149a3566bdf.
Report an issue: GitHub.