{"record":{"id":"a2320cdfbeaf2eb4","repo":"tauri-apps/tauri","slug":"failed-to-convert-bundle-path-to-string","errorCode":null,"errorMessage":"failed to convert bundle_path to string","messagePattern":"failed to convert bundle_path to string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-macos-sign/src/lib.rs","lineNumber":158,"sourceCode":"  auth: &AppleNotarizationCredentials,\n  wait: bool,\n) -> Result<()> {\n  let bundle_stem = app_bundle_path\n    .file_stem()\n    .expect(\"failed to get bundle filename\");\n\n  let tmp_dir = tempfile::tempdir().map_err(Error::TempDir)?;\n  let zip_path = tmp_dir\n    .path()\n    .join(format!(\"{}.zip\", bundle_stem.to_string_lossy()));\n  let zip_args = vec![\n    \"-c\",\n    \"-k\",\n    \"--keepParent\",\n    \"--sequesterRsrc\",\n    app_bundle_path\n      .to_str()\n      .expect(\"failed to convert bundle_path to string\"),\n    zip_path\n      .to_str()\n      .expect(\"failed to convert zip_path to string\"),\n  ];\n\n  // use ditto to create a PKZip almost identical to Finder\n  // this remove almost 99% of false alarm in notarization\n  assert_command(\n    Command::new(\"ditto\").args(zip_args).piped(),\n    \"failed to zip app with ditto\",\n  )\n  .map_err(|error| Error::CommandFailed {\n    command: \"ditto\".to_string(),\n    error,\n  })?;\n\n  // sign the zip file\n  keychain.sign(&zip_path, None, false)?;","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-macos-sign/src/lib.rs#L140-L176","documentation":"Panic in tauri-macos-sign's notarization zip step: app_bundle_path.to_str().expect(\"failed to convert bundle_path to string\") fails when the path contains bytes that are not valid UTF-8. The `ditto` command is invoked with string arguments, so a bundle path with a non-UTF-8 byte (common with legacy-encoded artifact names) aborts notarization.","triggerScenarios":"Notarizing an .app whose full path includes non-UTF-8 bytes — e.g. a download/cache directory named with Latin-1 characters, or a bundle filename mangled by an unzip/archive tool.","commonSituations":"Artifacts produced on machines with legacy locale encodings; archives extracted with tools that preserve invalid byte sequences; CI workspaces named from user-provided strings.","solutions":["Move/rename the .app and its parent directories to pure ASCII/UTF-8 names before signing and notarizing","Fix the pipeline step that produced the non-UTF-8 name and regenerate the artifact","Validate early in your wrapper: path.to_str().is_some(), failing with a clear message naming the offending path"],"exampleFix":"# before\n/Applications/My App\\xa0.app  → panic: failed to convert bundle_path to string\n\n# after\nmv \"$(printf 'My App\\xa0.app')\" \"MyApp.app\"\nxcrun notarytool submit MyApp.app.zip ...","handlingStrategy":"validation","validationCode":"fn is_utf8_path(p: &std::path::Path) -> bool { p.to_str().is_some() }\nassert!(is_utf8_path(&app_bundle_path), \"bundle path must be UTF-8 before notarize\");","typeGuard":"fn utf8_path(p: &std::path::Path) -> Option<&str> { p.to_str() }","tryCatchPattern":null,"preventionTips":["Keep artifact directories and bundle names pure ASCII","Check to_str() early in release scripts and fail with the offending path","Re-extract archives with tools that sanitize filenames to UTF-8"],"tags":["macos","notarization","utf8","path"],"backgroundTag":"non-utf8-path","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","contentChangedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}