{"record":{"id":"c60ffcb33683bad2","repo":"tauri-apps/tauri","slug":"failed-to-serialize-plist","errorCode":null,"errorMessage":"failed to serialize plist","messagePattern":"failed to serialize plist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri-codegen/src/context.rs","lineNumber":338,"sourceCode":"      }\n\n      if let Some(version) = &config.version {\n        let bundle_version = &config.bundle.macos.bundle_version;\n        plist.insert(\"CFBundleShortVersionString\".into(), version.clone().into());\n        plist.insert(\n          \"CFBundleVersion\".into(),\n          bundle_version\n            .clone()\n            .unwrap_or_else(|| version.clone())\n            .into(),\n        );\n      }\n    }\n\n    let mut plist_contents = std::io::BufWriter::new(Vec::new());\n    info_plist\n      .to_writer_xml(&mut plist_contents)\n      .expect(\"failed to serialize plist\");\n    let plist_contents =\n      String::from_utf8_lossy(&plist_contents.into_inner().unwrap()).into_owned();\n\n    let plist = crate::Cached::try_from(plist_contents)?;\n    quote!({\n      tauri::embed_plist::embed_info_plist!(#plist);\n    })\n  } else {\n    quote!()\n  };\n  #[cfg(not(target_os = \"macos\"))]\n  let maybe_embed_plist_block = quote!();\n\n  let pattern = match &options.pattern {\n    PatternKind::Brownfield => quote!(#root::Pattern::Brownfield),\n    #[cfg(not(feature = \"isolation\"))]\n    PatternKind::Isolation { dir: _ } => {\n      quote!(#root::Pattern::Brownfield)","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri-codegen/src/context.rs#L320-L356","documentation":"In tauri-codegen's map_isolation (the isolation pattern codegen), the generated Info.plist is serialized to XML via plist::to_writer_xml and the result is .expect()'d. If the in-memory plist structure cannot be serialized to XML (structurally invalid plist value, e.g. invalid key types), the panic 'failed to serialize plist' fires at compile time of the Tauri app.","triggerScenarios":"map_isolation -> map_isolation (called recursively) while codebuilding an app that enables the isolation pattern (dangerousRemoteDomainIpcAccess / isolation origin) and the constructed info_plist value fails XML serialization.","commonSituations":"Enabling Tauri's isolation pattern with a dangerousRemoteDomainIpcAccess config that produces a plist entry the plist crate cannot represent; a tauri-codegen/plist crate version incompatibility; very unusual origin strings containing characters that break plist serialization.","solutions":["Review dangerousRemoteDomainIpcAccess / isolation settings in tauri.conf.json; simplify or correct the remote domain/origin entries.","Update tauri (tauri-codegen) to the latest patch version; this may be a fixed codegen bug.","Temporarily disable the isolation pattern to confirm it is the trigger, then re-enable with corrected config.","Check for non-ASCII or special characters in app identifiers/origins that may break plist XML generation."],"exampleFix":"// before (tauri.conf.json)\n\"dangerousRemoteDomainIpcAccess\": [{\"scheme\": \"https\", \"domain\": \"my app.example.com\", \"windows\": [\"main\"], \"plugins\": [\"fs\"]}]\n// after\n\"dangerousRemoteDomainIpcAccess\": [{\"scheme\": \"https\", \"domain\": \"myapp.example.com\", \"windows\": [\"main\"], \"plugins\": [\"fs\"]}]","handlingStrategy":"validation","validationCode":"// Validate isolation config before building\nlet accesses = &config.tauri.dangerous_remote_domain_ipc_access;\nfor a in accesses {\n  assert!(!a.domain.contains(' '), \"invalid domain in dangerousRemoteDomainIpcAccess: {}\", a.domain);\n  assert!(matches!(a.scheme.as_str(), \"https\" | \"http\"), \"invalid scheme: {}\", a.scheme);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep remote domain/origin entries simple and ASCII in dangerousRemoteDomainIpcAccess.","Keep tauri-codegen and the plist crate versions in sync via a single lockfile.","Test isolation-pattern builds in CI before releases."],"tags":["plist","codegen","macos","isolation","serde"],"backgroundTag":"json-marshal-failed","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"}