Repository navigation
Description
Plugin version
2.4.0.0
Server
Jellyfin
Server version
12.1.0
Area
Config page
What happened
The plugin repository auto-updated Moonbase from a manually installed 2.2.0.0 (living in plugins/Moonbase/) to 2.4.0.0, which landed in a new plugins/Moonbase_2.4.0.0/ directory while the old directory stayed. On the next restart Jellyfin loaded both assemblies (the plugin folder is Moonbase, the assembly inside is Moonfin.Server.dll — that's the naming in the paths below), one of the two plugin instances then failed to create, and the shared plugins/configurations/Moonfin.Server.xml got truncated to a 38-byte XML declaration. Every subsequent restart re-wrote the same empty shell, so all server-wide Moonbase settings were gone.
The stack from Jellyfin's log at plugin-creation time (the cast direction shows the cached serializer was bound to the 2.4.0.0 type while the object being saved came from the 2.2.0.0 side):
[ERR] Emby.Server.Implementations.Plugins.PluginManager: Error creating Moonfin.Server.MoonfinPlugin
System.InvalidOperationException: There was an error generating the XML document.
---> System.InvalidCastException: [A]Moonfin.Server.PluginConfiguration cannot be cast to [B]Moonfin.Server.PluginConfiguration.
Type A originates from 'Moonfin.Server, Version=2.2.0.0' ... PluginLoadContext #3 ... at '/var/lib/jellyfin/plugins/Moonbase/Moonfin.Server.dll'.
Type B originates from 'Moonfin.Server, Version=2.4.0.0' ... PluginLoadContext #2 ... at '/var/lib/jellyfin/plugins/Moonbase_2.4.0.0/Moonfin.Server.dll'.
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterPluginConfiguration.Write9_PluginConfiguration(Object o)
at System.Xml.Serialization.XmlSerializer.Serialize(...)
at Emby.Server.Implementations.Serialization.MyXmlSerializer.SerializeToWriter(...)
at Emby.Server.Implementations.Serialization.MyXmlSerializer.SerializeToFile(...)
at MediaBrowser.Common.Plugins.BasePlugin`1.SaveConfiguration(...)
at MediaBrowser.Common.Plugins.BasePlugin`1.LoadConfiguration(...)
at MediaBrowser.Common.Plugins.BasePlugin`1.get_Configuration(...)
at Moonfin.Server.MoonfinPlugin..ctor(...)
$ wc -c /var/lib/jellyfin/plugins/configurations/Moonfin.Server.xml
38 /var/lib/jellyfin/plugins/configurations/Moonfin.Server.xml
$ cat /var/lib/jellyfin/plugins/configurations/Moonfin.Server.xml
<?xml version="1.0" encoding="utf-8"?>
Steps to reproduce
- Get Moonbase 2.2.0.0 (e.g. from the 2.2.0 release) and install it manually so it lives in
plugins/Moonbase/(directory name without version suffix), as the README's manual-install section describes. - Add the official Moonbase repository (
https://raw.githubusercontent.com/Moonfin-Client/Plugin/refs/heads/master/manifest.json) and let the "Update plugins" scheduled task install 2.4.0.0, which lands inplugins/Moonbase_2.4.0.0/. - Restart Jellyfin (12.1.0). Both versions load; one instance fails to create with the stack above;
Moonfin.Server.xmlis truncated to 38 bytes and stays that way across restarts.
Frequency
Every restart while both version directories exist (two occurrences across two restarts in our logs, at 21:43 and 22:48 the same evening).
Root cause and workaround
We believe the corruption mechanism itself is entirely on the Jellyfin side, though the trigger involves how Jellyfin's updater treats a manually installed Moonbase, so other Moonbase users will hit this too:
- Jellyfin's
MyXmlSerializercachesXmlSerializerinstances keyed bytype.FullName(source). Two versions of Moonfin.Server define the same-namedMoonfin.Server.PluginConfiguration, so whichever version loads second gets a serializer bound to the first version's type, and saving then fails with theInvalidCastExceptionabove. - Jellyfin's
BasePlugin.LoadConfiguration()catches a failed config read and re-saves a default config — but that save goes through the same mismatched serializer, so it fails too (source). SerializeToFileopens the destination withFileMode.Createbefore serializing, so the failure above leaves the file truncated at the 38-byte XML declaration. The config is destroyed exactly when the code is trying to recover it, and again on every restart.
We have opened an upstream PR against Jellyfin fixing the cache keying and the non-atomic write (with the cache key fixed, the mismatched-serializer failures stop happening, so points 2–3 can no longer destroy the file): jellyfin/jellyfin#18363
Workaround: stop Jellyfin, delete one of the two directories (Moonbase_2.4.0.0/ to stay on 2.2.0.0, or Moonbase/ to move fully to 2.4.0.0 — the previous config contents are already lost once the file is truncated), restore Moonfin.Server.xml from an external backup if you have one, start Jellyfin again.
Suggested actions (from a Moonbase maintainer's seat)
- Pin/hold the plugin version on servers that installed Moonbase manually (NixOS-style declarative installs or manual README installs), at least until the Jellyfin fix lands in a release.
- One point that may be worth a look on the Moonbase side: with this failure the config-backup/restore path introduced in 2.3.0 never gets a chance to help, because the failing instance dies during construction — nothing of that instance runs at all. A plugin that can't construct is also a plugin that can't self-recover, so if there's any way to make the constructor resilient to
Configurationthrowing (it already swallows exceptions inTryMigrateConfiguration, but this one escapes from the base-class property getter), this class of Jellyfin-side breakage would at least fail soft. - A note in Moonbase's wiki installation page warning manual-install users that repository auto-updates create a second version directory would have saved us a long evening.
Environment
- Jellyfin 12.1.0 (NixOS package), Moonbase 2.4.0.0 auto-updated from 2.2.0.0
- Two plugin directories present:
Moonbase/(manual install) andMoonbase_2.4.0.0/(repository update) - Client: N/A — server-side failure
Activity
github-actions commentedon Oct 9, 2026
Thanks for the report, @luochen1990.
Before anyone can pick this up it needs a little more from you, so it has been labelled Missing Screenshot.
A screenshot is missing
The plugin keeps no diagnostic log of its own, so a picture of what you're seeing is the fastest way to make a report actionable.
Drag a screenshot straight into a comment below, showing the plugin config page, the client screen, or whatever is wrong. For a sync problem, the same setting on each client side by side is what makes it obvious.
Win + Shift + SCmd + Shift + 4PrtSc, or your desktop screenshot toolIt's also worth pasting anything the server logged. Open the Logs page in your Jellyfin or Emby dashboard and search for
Moonfin, which is the name the plugin logs under.Each label comes off automatically once that piece is sorted.
luochen1990 commentedon Oct 9, 2026
Reproduced from scratch in a clean environment to verify the steps above (official Jellyfin 12.1.0,
plugins/Moonbase/from the 2.2.0.0 release zip +plugins/Moonbase_2.4.0.0/from the 2.4.0.0 release zip, fresh data dir). Same failure: one instance fails to create with theInvalidCastException, andMoonfin.Server.xmlends up a 38-byte empty shell.What the dashboard looks like at the same time — note Moonbase shows 2.4.0.0 Active, no error anywhere in the UI, which is what makes this so hard to notice from the admin's seat:
(Server name in the screenshots is the reproduction machine's hostname, not the original server.)
RadicalMuffinMan commentedon Oct 9, 2026
Thanks for digging into this and for opening the upstream PR.
On a normal install this shouldn't happen. When the repo installs an update, Jellyfin marks the old version Superseded by plugin GUID and skips it on the next start. That needs a write to the old folder's meta.json. My guess is your plugins/Moonbase/ is a read-only Nix store path, which could also explain why it repeats on every restart.
If you manage Moonbase declaratively, turn off repo auto-update for it and update by replacing the folder. 2.4 already catches errors in its constructor. I'll add a note about mixing install methods to the wiki. Closing for now since the PR was opened upstream, thank you!