I am also seeing this error, with almost the same combination of versions, just pymc 5.28.5 instead of 5.28.4. Error message:
TypeError: Invalid value for attr 'sample_stats': {'inference_library': 'nutpie', 'inference_library_version': '0.16.10', 'inference_library_settings': '{"sampler": "nuts", "adaptation": "diag", "settings": {"num_tune": 1000, "num_draws": 600, "maxdepth": 10, "mindepth": 0, "store_gradient": false, "store_unconstrained": false, "store_transformed": false, "max_energy_error": 1000.0, "store_divergences": false, "adapt_options": {"step_size_settings": {"target_accept": 0.9, "initial_step": 0.1, "jitter": 0.1, "adapt_options": {"method": "DualAverage", "dual_average": {"k": 0.75, "t0": 10.0, "gamma": 0.05, "max_step_size": 3.141592653589793}, "adam": {"beta1": 0.9, "beta2": 0.999, "epsilon": 1e-08, "learning_rate": 0.05}}}, "mass_matrix_options": {"store_mass_matrix": false, "use_grad_based_estimate": true}, "early_window": 0.3, "step_size_window": 0.15, "mass_matrix_switch_freq": 80, "early_mass_matrix_switch_freq": 10, "mass_matrix_update_freq": 1, "mass_matrix_window_growth": 1.5}, "check_turning": true, "target_integration_time": null, "trajectory_kind": "Euclidean", "num_chains": 2, "seed": 18013295764713678085, "extra_doublings": 0}}'}. For serialization to netCDF files, its value must be of one of the following types: str, Number, ndarray, number, list, tuple, bytes
synth.history_trace.sample_stats.attrs
{'created_at': '2026-06-10T12:58:36.165129+00:00', 'arviz_version': '0.23.4'}
I cannot replicate the error with a small example, so perhaps some combination of settings or model complexity.
Perhaps this is a reason to upgrade to pymc 6?