tauri-apps/tauri · error
Can't extract file name from path
Error message
Can't extract file name from path
What it means
create_zip stores the source installer inside the zip under its file_name. The expect fires when the source artifact path (the built installer being archived for the updater) has no final file-name component — a root or a path ending with '..'.
Source
Thrown at crates/tauri-bundler/src/bundle/updater_bundle.rs:211
log::info!(action = "Bundling"; "{}", display_path(&archived_path));
// Create our gzip file
create_zip(&source_path, &archived_path).with_context(|| "Failed to zip update bundle")?;
installers_archived_paths.push(archived_path);
}
Ok(installers_archived_paths)
}
pub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {
let parent_dir = dst_file.parent().expect("No data in parent");
fs::create_dir_all(parent_dir)?;
let writer = fs_utils::create_file(dst_file)?;
let file_name = src_file
.file_name()
.expect("Can't extract file name from path");
let mut zip = zip::ZipWriter::new(writer);
let options = SimpleFileOptions::default()
.compression_method(zip::CompressionMethod::Stored)
.unix_permissions(0o755);
zip.start_file(file_name.to_string_lossy(), options)?;
let mut f =
File::open(src_file).fs_context("failed to open updater ZIP file", src_file.to_path_buf())?;
let mut buffer = Vec::new();
f.read_to_end(&mut buffer)?;
zip.write_all(&buffer)?;
buffer.clear();
Ok(dst_file.to_owned())
}
View on GitHub (pinned to 52e4b6e71d)
Solutions
- Re-run from a clean target with the stock bundle configuration
- Check productName and binary settings in tauri.conf.json for empty strings or '..'-style values that corrupt path construction
- Report upstream with the full config if it reproduces
Defensive patterns
Strategy: validation
Validate before calling
// keep product/binary names path-safe so installer paths keep a file name
const unsafe = [config.productName, config.bundle?.active ? config.binary : null]
.filter((s) => s === null || s === '' || s.includes('..'));
if (unsafe.length) throw new Error('productName/binary must be non-empty and path-safe'); Type guard
const isSafeName = (s) => typeof s === 'string' && s.length > 0 && !s.includes('/') && !s.includes('..'); Prevention
- Keep productName and binary free of path separators, '..' and empty values
- Validate tauri.conf.json against the published schema before building
When it happens
Trigger: tauri build with updater artifacts enabled where the installer path computed from bundle settings degenerates so file_name() is None; practically only reachable with heavily customized product names or path overrides that collapse the installer path.
Common situations: Extreme edge-case configuration (empty or '..'-like productName/binary values); normally unreachable in stock projects.
Related errors
- No data in parent
- Path has no file_name
- Can't read source directory
- failed to extract merge module filename
- Unexpected target triple {}
AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20).
Data as JSON: /api/errors/e0feac977d3961a6.
Report an issue: GitHub.