{"record":{"id":"e0feac977d3961a6","repo":"tauri-apps/tauri","slug":"can-t-extract-file-name-from-path","errorCode":null,"errorMessage":"Can't extract file name from path","messagePattern":"Can't extract file name from path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/updater_bundle.rs","lineNumber":211,"sourceCode":"    log::info!(action = \"Bundling\"; \"{}\", display_path(&archived_path));\n\n    // Create our gzip file\n    create_zip(&source_path, &archived_path).with_context(|| \"Failed to zip update bundle\")?;\n\n    installers_archived_paths.push(archived_path);\n  }\n\n  Ok(installers_archived_paths)\n}\n\npub fn create_zip(src_file: &Path, dst_file: &Path) -> crate::Result<PathBuf> {\n  let parent_dir = dst_file.parent().expect(\"No data in parent\");\n  fs::create_dir_all(parent_dir)?;\n  let writer = fs_utils::create_file(dst_file)?;\n\n  let file_name = src_file\n    .file_name()\n    .expect(\"Can't extract file name from path\");\n\n  let mut zip = zip::ZipWriter::new(writer);\n  let options = SimpleFileOptions::default()\n    .compression_method(zip::CompressionMethod::Stored)\n    .unix_permissions(0o755);\n\n  zip.start_file(file_name.to_string_lossy(), options)?;\n  let mut f =\n    File::open(src_file).fs_context(\"failed to open updater ZIP file\", src_file.to_path_buf())?;\n\n  let mut buffer = Vec::new();\n  f.read_to_end(&mut buffer)?;\n  zip.write_all(&buffer)?;\n  buffer.clear();\n\n  Ok(dst_file.to_owned())\n}\n","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-bundler/src/bundle/updater_bundle.rs#L193-L229","documentation":"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 '..'.","triggerScenarios":"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.","commonSituations":"Extreme edge-case configuration (empty or '..'-like productName/binary values); normally unreachable in stock projects.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// keep product/binary names path-safe so installer paths keep a file name\nconst unsafe = [config.productName, config.bundle?.active ? config.binary : null]\n  .filter((s) => s === null || s === '' || s.includes('..'));\nif (unsafe.length) throw new Error('productName/binary must be non-empty and path-safe');","typeGuard":"const isSafeName = (s) => typeof s === 'string' && s.length > 0 && !s.includes('/') && !s.includes('..');","tryCatchPattern":null,"preventionTips":["Keep productName and binary free of path separators, '..' and empty values","Validate tauri.conf.json against the published schema before building"],"tags":["updater","zip","file-name","invariant","tauri-bundler"],"backgroundTag":"invalid-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}