{"record":{"id":"a3f989cf10f4dd16","repo":"tauri-apps/tauri","slug":"failed-to-convert-apple-signing-identity-to-string","errorCode":null,"errorMessage":"failed to convert APPLE_SIGNING_IDENTITY to string","messagePattern":"failed to convert APPLE_SIGNING_IDENTITY to string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-cli/src/interface/rust.rs","lineNumber":1451,"sourceCode":"      }\n      depends_rpm.push(requires);\n    }\n  }\n\n  #[cfg(windows)]\n  {\n    if let crate::helpers::config::WebviewInstallMode::FixedRuntime { path } =\n      &config.windows.webview_install_mode\n    {\n      resources.push(path.display().to_string());\n    }\n  }\n\n  let signing_identity = match std::env::var_os(\"APPLE_SIGNING_IDENTITY\") {\n    Some(signing_identity) => Some(\n      signing_identity\n        .to_str()\n        .expect(\"failed to convert APPLE_SIGNING_IDENTITY to string\")\n        .to_string(),\n    ),\n    None => config.macos.signing_identity,\n  };\n\n  let provider_short_name = match std::env::var_os(\"APPLE_PROVIDER_SHORT_NAME\") {\n    Some(provider_short_name) => Some(\n      provider_short_name\n        .to_str()\n        .expect(\"failed to convert APPLE_PROVIDER_SHORT_NAME to string\")\n        .to_string(),\n    ),\n    None => config.macos.provider_short_name,\n  };\n\n  let (resources, resources_map) = match resources {\n    BundleResources::List(paths) => (Some(paths), None),\n    BundleResources::Map(map) => (None, Some(map)),","sourceCodeStart":1433,"sourceCodeEnd":1469,"githubUrl":"https://github.com/tauri-apps/tauri/blob/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-cli/src/interface/rust.rs#L1433-L1469","documentation":"When bundling for macOS, the CLI overrides the config's signing identity with the APPLE_SIGNING_IDENTITY environment variable. to_str() on the OsString returns None when the variable contains non-UTF-8 bytes, and this expect panics. The value itself is only parsed, so any valid UTF-8 identity string works; only the encoding can fail.","triggerScenarios":"Running `tauri build`/`tauri ios build` on macOS with APPLE_SIGNING_IDENTITY exported containing raw non-UTF-8 bytes — a mis-encoded export line in a sourced script, a CI secret saved with a bad encoding, or a locale-mangled value.","commonSituations":"CI secrets defined with stray bytes/BOM; shell profiles written by tools in non-UTF-8 locales; identities pasted from rich text introducing invisible invalid bytes.","solutions":["Inspect the variable: `python3 -c \"import os;print(os.environ['APPLE_SIGNING_IDENTITY'].encode())\"` or `env | grep APPLE_SIGNING_IDENTITY | xxd | head`.","Re-export it as plain ASCII/UTF-8: `export APPLE_SIGNING_IDENTITY=\"Apple Development: Team (ID)\"`.","Re-enter the CI secret (delete and re-create) ensuring plain text.","Find valid identities with `security find-identity -v -p codesigning` and copy one exactly."],"exampleFix":"# before: contains invalid bytes (e.g. 0xff prefix)\nexport APPLE_SIGNING_IDENTITY=$'\\xffApple Development'\n\n# after\nexport APPLE_SIGNING_IDENTITY=\"Apple Development: AB12CD34EF (1234567890)\"","handlingStrategy":"validation","validationCode":"# Reject non-UTF-8 before building\npython3 - <<'EOF'\nimport os, sys\nv = os.environb.get(b'APPLE_SIGNING_IDENTITY')\nif v is not None:\n    try: v.decode('utf-8')\n    except UnicodeDecodeError:\n        sys.exit('APPLE_SIGNING_IDENTITY is not valid UTF-8')\nEOF","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enter codesigning secrets as plain ASCII and re-create CI secrets rather than copying from formatted docs.","Use `security find-identity -v -p codesigning` output as the canonical string to export.","Add a UTF-8 env preflight in CI before tauri build on macOS."],"tags":["macos","codesigning","environment","utf-8","tauri-cli"],"backgroundTag":"invalid-utf8-env-var","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"}