{"record":{"id":"6c4d7f9533def2bf","repo":"tauri-apps/tauri","slug":"non-utf-8-path-rel-path","errorCode":null,"errorMessage":"Non-UTF-8 path: {rel_path:?}","messagePattern":"Non-UTF-8 path: (.+?)","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/tauri-bundler/src/bundle/linux/debian.rs","lineNumber":320,"sourceCode":"fn generate_md5sums(control_dir: &Path, data_dir: &Path) -> crate::Result<()> {\n  let md5sums_path = control_dir.join(\"md5sums\");\n  let mut md5sums_file = fs_utils::create_file(&md5sums_path)?;\n  for entry in WalkDir::new(data_dir) {\n    let entry = entry?;\n    let path = entry.path();\n    if path.is_dir() {\n      continue;\n    }\n    let mut file = File::open(path)?;\n    let mut hash = md5::Context::new();\n    io::copy(&mut file, &mut hash)?;\n    for byte in hash.finalize().iter() {\n      write!(md5sums_file, \"{byte:02x}\")?;\n    }\n    let rel_path = path.strip_prefix(data_dir)?;\n    let path_str = rel_path.to_str().ok_or_else(|| {\n      let msg = format!(\"Non-UTF-8 path: {rel_path:?}\");\n      io::Error::new(io::ErrorKind::InvalidData, msg)\n    })?;\n    writeln!(md5sums_file, \"  {path_str}\")?;\n  }\n  Ok(())\n}\n\n/// Copy the bundle's resource files into an appropriate directory under the\n/// `data_dir`.\nfn copy_resource_files(settings: &Settings, data_dir: &Path) -> crate::Result<()> {\n  let resource_dir = data_dir.join(\"usr/lib\").join(settings.product_name());\n  settings.copy_resources(&resource_dir)\n}\n\n/// Create an empty file at the given path, creating any parent directories as\n/// needed, then write `data` into the file.\nfn create_file_with_data<P: AsRef<Path>>(path: P, data: &str) -> crate::Result<()> {\n  let mut file = fs_utils::create_file(path.as_ref())?;\n  file.write_all(data.as_bytes())?;","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-bundler/src/bundle/linux/debian.rs#L302-L338","documentation":"While generating the md5sums control file for a .deb package, every installed file's path relative to the data dir must be written as UTF-8 text. If a filename is not valid UTF-8, generate_md5sums creates this io::Error instead of producing a corrupt checksums file.","triggerScenarios":"Bundling a Debian package whose data directory contains a file or directory with non-UTF-8 encoded name (generate_md5sums iterates all files under data_dir).","commonSituations":"Packaging resources with filenames created on systems using legacy encodings (e.g. Latin-1), archives extracted with non-UTF-8 filename encoding, or files with invalid bytes from third-party tooling.","solutions":["Rename the offending file(s) so their names are valid UTF-8 before bundling","Fix the source of the resource files (extraction tool or archive) to use UTF-8 names","Identify the culprit via the printed {rel_path:?} debug path in the error"],"exampleFix":"// before\n$ ls data/usr/share/app  # file named config?lat?n (invalid bytes)\nmv 'config?lat?n' config-latin.txt\n// after\n$ cargo tauri build --bundles deb  # proceeds","handlingStrategy":"validation","validationCode":"// before bundling a deb, verify all payload filenames are UTF-8\nconst checkUtf8Names = (dir) => {\n  for (const f of fs.readdirSync(dir, { recursive: true })) {\n    const s = Buffer.from(f).toString('utf8');\n    if (Buffer.from(s, 'utf8').toString('utf8') !== f || f.includes('\\uFFFD')) throw new Error(`Non-UTF-8 filename: ${f}`);\n  }\n};","typeGuard":null,"tryCatchPattern":"try {\n  await bundleDeb();\n} catch (e) {\n  if (String(e).includes('Non-UTF-8 path')) console.error('Rename the printed file to a UTF-8 name and rebuild');\n  throw e;\n}","preventionTips":["Extract archives with UTF-8-aware tools (e.g. unzip -O UTF-8, bsdtar)","Reject non-UTF-8 filenames in resource preparation scripts","Verify with `convmv` or `find ... -name` scans before packaging"],"tags":["linux","debian","encoding","utf8"],"backgroundTag":"invalid-argument-format","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"}