{"record":{"id":"4ca72ac63bef6891","repo":"tauri-apps/tauri","slug":"failed-to-convert-bundle-filename-to-string","errorCode":null,"errorMessage":"failed to convert bundle filename to string","messagePattern":"failed to convert bundle filename to string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-macos-sign/src/lib.rs","lineNumber":258,"sourceCode":"        String::from_utf8_lossy(&output.stdout)\n      )))\n    } else {\n      Err(Error::Notarize(log_message))\n    }\n  } else {\n    Err(Error::ParseNotarytoolOutput {\n      output: output_str.into_owned(),\n    })\n  }\n}\n\nfn staple_app(mut app_bundle_path: PathBuf) -> Result<()> {\n  let app_bundle_path_clone = app_bundle_path.clone();\n  let filename = app_bundle_path_clone\n    .file_name()\n    .expect(\"failed to get bundle filename\")\n    .to_str()\n    .expect(\"failed to convert bundle filename to string\");\n\n  app_bundle_path.pop();\n\n  Command::new(\"xcrun\")\n    .args(vec![\"stapler\", \"staple\", \"-v\", filename])\n    .current_dir(app_bundle_path)\n    .output()\n    .map_err(|error| Error::CommandFailed {\n      command: \"xcrun stapler staple\".to_string(),\n      error,\n    })?;\n\n  Ok(())\n}\n\npub trait NotarytoolCmdExt {\n  fn notarytool_args(\n    &mut self,","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-macos-sign/src/lib.rs#L240-L276","documentation":"staple_app converts the bundle filename to &str for the xcrun stapler invocation; the panic means the final path component contains invalid UTF-8. The filename must be passed as a command-line argument, which requires UTF-8.","triggerScenarios":"notarize finishing successfully and calling staple_app with a bundle whose file name has non-UTF-8 bytes.","commonSituations":"App bundles named with characters outside UTF-8 from unusual filesystems or scripted renames.","solutions":["Rename the .app bundle to a UTF-8 (preferably ASCII) name before notarizing","Check any rename/copy step in the build script for byte-level operations","Validate path.to_str() early in the pipeline"],"exampleFix":"// before\nmv \"My App\\xff.app\" dist/My\\xffApp.app\n// after\nmv \"My App.app\" dist/MyApp.app","handlingStrategy":"validation","validationCode":"assert!(\n    bundle_path.file_name().and_then(|n| n.to_str()).is_some(),\n    \"bundle filename must be valid UTF-8\"\n);","typeGuard":"fn utf8_file_name(p: &Path) -> Option<&str> { p.file_name()?.to_str() }","tryCatchPattern":null,"preventionTips":["Name app bundles with plain ASCII identifiers","Avoid byte-level rename operations in build scripts","Validate the final bundle name before distribution steps"],"tags":["macos","staple","utf-8","path-handling"],"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"}