{"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/52e4b6e71d8632a7e648f866c442e287ecddee34/crates/tauri-codegen/src/context.rs#L320-L356","documentation":"Build-time panic inside tauri-codegen while assembling the macOS Info.plist for tauri::generate_context!. The collected plist dictionary is written with info_plist.to_writer_xml(..).expect(\"failed to serialize plist\"); the plist crate refuses values it cannot represent in XML plist form (unsupported types or invalid values in the merged Info.plist data), aborting compilation of the app crate.","triggerScenarios":"A tauri.conf.json macOS section (or an Info.plist supplied via `bundle > macOS > infoPlistPath` / extended plist entries) containing a value the plist serializer cannot encode — e.g. a null, a nested object where a scalar is expected, or an unsupported type injected by config merging.","commonSituations":"Hand-edited Info.plist files with wrong value types; JSON merge/templating tools inserting nulls into plist entries; rarely, a plist serializer regression after a dependency upgrade changed tauri-codegen's plist crate.","solutions":["Lint any plist file fed to the bundler: `plutil -lint <path>` on the file referenced by bundle > macOS > infoPlistPath","Check custom plist entries in tauri.conf.json — values must be string, bool, number, array, or dict; remove nulls and odd types","Run cargo clean and rebuild so codegen regenerates the embedded plist from scratch","If it appeared after an upgrade, align tauri / tauri-codegen / tauri-utils versions (cargo update -p tauri-codegen) or pin the previously working versions"],"exampleFix":"// tauri.conf.json — before\n\"macOS\": { \"infoPlistPath\": \"macos/Info.plist\" } // Info.plist has a null value\n\n// after: fix the source file (nulls are invalid in plist XML)\n% plutil -lint macos/Info.plist   // must print OK before building","handlingStrategy":"validation","validationCode":"# fail fast on invalid plist before building\nplutil -lint macos/Info.plist || exit 1\njq -e '.. | select(type == \"null\") | error(\"null value in config\")' src-tauri/tauri.conf.json > /dev/null","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint every Info.plist referenced by infoPlistPath with plutil in CI","Keep custom plist entries to string/bool/number/array/dict; forbid nulls in config schemas","Clean the target directory after dependency upgrades that touch tauri-codegen"],"tags":["macos","plist","build","codegen"],"backgroundTag":"plist-serialization-failed","analyzedSha":"52e4b6e71d8632a7e648f866c442e287ecddee34","analyzedAt":"2026-08-20T13:59:20.734Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}