tauri-apps/tauri · error

failed to serialize plist

Error message

failed to serialize plist

What it means

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.

Source

Thrown at crates/tauri-codegen/src/context.rs:338

      }

      if let Some(version) = &config.version {
        let bundle_version = &config.bundle.macos.bundle_version;
        plist.insert("CFBundleShortVersionString".into(), version.clone().into());
        plist.insert(
          "CFBundleVersion".into(),
          bundle_version
            .clone()
            .unwrap_or_else(|| version.clone())
            .into(),
        );
      }
    }

    let mut plist_contents = std::io::BufWriter::new(Vec::new());
    info_plist
      .to_writer_xml(&mut plist_contents)
      .expect("failed to serialize plist");
    let plist_contents =
      String::from_utf8_lossy(&plist_contents.into_inner().unwrap()).into_owned();

    let plist = crate::Cached::try_from(plist_contents)?;
    quote!({
      tauri::embed_plist::embed_info_plist!(#plist);
    })
  } else {
    quote!()
  };
  #[cfg(not(target_os = "macos"))]
  let maybe_embed_plist_block = quote!();

  let pattern = match &options.pattern {
    PatternKind::Brownfield => quote!(#root::Pattern::Brownfield),
    #[cfg(not(feature = "isolation"))]
    PatternKind::Isolation { dir: _ } => {
      quote!(#root::Pattern::Brownfield)

View on GitHub (pinned to 52e4b6e71d)

Solutions

  1. Lint any plist file fed to the bundler: `plutil -lint <path>` on the file referenced by bundle > macOS > infoPlistPath
  2. Check custom plist entries in tauri.conf.json — values must be string, bool, number, array, or dict; remove nulls and odd types
  3. Run cargo clean and rebuild so codegen regenerates the embedded plist from scratch
  4. If it appeared after an upgrade, align tauri / tauri-codegen / tauri-utils versions (cargo update -p tauri-codegen) or pin the previously working versions

Example fix

// tauri.conf.json — before
"macOS": { "infoPlistPath": "macos/Info.plist" } // Info.plist has a null value

// after: fix the source file (nulls are invalid in plist XML)
% plutil -lint macos/Info.plist   // must print OK before building
Defensive patterns

Strategy: validation

Validate before calling

# fail fast on invalid plist before building
plutil -lint macos/Info.plist || exit 1
jq -e '.. | select(type == "null") | error("null value in config")' src-tauri/tauri.conf.json > /dev/null

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of tauri-apps/tauri@52e4b6e71d (2026-08-20). Data as JSON: /api/errors/c60ffcb33683bad2. Report an issue: GitHub.