Jellyfin Forum
System.InvalidOperationException: There is an error in XML document (0, 0). - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: System.InvalidOperationException: There is an error in XML document (0, 0). (/t-system-invalidoperationexception-there-is-an-error-in-xml-document-0-0)



System.InvalidOperationException: There is an error in XML document (0, 0). - endymion1818 - 2024-01-03

I keep getting this issue even after updating Jellyfin and dependencies. It happened unexpectedly and I can't figure out why or which XML document has an error:

[09:23:19] [INF] [1] Main: Jellyfin version: 10.8.13
[09:23:19] [INF] [1] Main: Environment Variables: ["[JELLYFIN_LOG_DIR, /home/redacted/jellyfin/log]"]
[09:23:19] [INF] [1] Main: Arguments: ["/usr/lib/jellyfin/bin/jellyfin.dll"]
[09:23:19] [INF] [1] Main: Operating system: Linux
[09:23:19] [INF] [1] Main: Architecture: X64
[09:23:19] [INF] [1] Main: 64-Bit Process: True
[09:23:19] [INF] [1] Main: User Interactive: True
[09:23:19] [INF] [1] Main: Processor count: 8
[09:23:19] [INF] [1] Main: Program data path: /home/redacted/jellyfin
[09:23:19] [INF] [1] Main: Web resources path: /usr/lib/jellyfin/bin/jellyfin-web
[09:23:19] [INF] [1] Main: Application directory: /usr/lib/jellyfin/bin/
[09:23:19] [FTL] [1] Main: Unhandled Exception
System.InvalidOperationException: There is an error in XML document (0, 0).
 ---> System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlTextReaderImpl.Read()
   at System.Xml.XmlReader.MoveToContent()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderServerConfiguration.Read10_ServerConfiguration()
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.DeserializeFromStream(Type type, Stream stream)
   at Emby.Server.Implementations.Serialization.MyXmlSerializer.DeserializeFromFile(Type type, String file)
   at Jellyfin.Server.Migrations.MigrationRunner.RunPreStartup(ServerApplicationPaths appPaths, ILoggerFactory loggerFactory)
   at Jellyfin.Server.Program.StartApp(StartupOptions options)
   at Jellyfin.Server.Program.<Main>(String[] args)

Short of uninstalling and reinstalling Jellyfin, is there any way of identifying what XML document is at fault?


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - TheDreadPirate - 2024-01-03

I'm not aware of how to figure out which is the problem. But /etc/jellyfin is the only directory that has XMLs that could break Jellyfin.

Code:
chris@rat-trap:/etc/jellyfin$ ll
total 76
drwxr-x---   5 jellyfin adm       4096 Jan  3 02:33 ./
drwxr-xr-x 145 root     root     12288 Dec 29 18:13 ../
-rw-r--r--   1 jellyfin jellyfin   263 Dec 22 19:35 branding.xml
drwxr-xr-x   4 jellyfin jellyfin  4096 Aug 15 12:05 dlna/
-rw-r--r--   1 jellyfin jellyfin   770 Aug 15 12:15 dlna.xml
-rw-r--r--   1 jellyfin jellyfin  2312 Jan  3 03:35 encoding.xml
-rw-r--r--   1 jellyfin jellyfin  1322 Oct 28 00:04 livetv.xml
-rw-r--r--   1 jellyfin jellyfin  1362 Aug 15 12:15 logging.default.json
-rw-r--r--   1 jellyfin root      1040 Aug 15 12:15 logging.json
-rw-r--r--   1 jellyfin jellyfin   260 Aug 15 12:15 metadata.xml
-rw-r--r--   1 jellyfin jellyfin  2181 Aug 15 12:15 migrations.xml
-rw-r--r--   1 jellyfin jellyfin  1546 Nov 24 12:58 network.xml
-rw-r--r--   1 jellyfin jellyfin   270 Jan  3 02:42 playback_reporting.xml
drwxr-xr-x   2 jellyfin jellyfin  4096 Dec 14 08:09 ScheduledTasks/
-rw-r--r--   1 jellyfin jellyfin  5979 Dec 22 19:35 system.xml
drwxr-xr-x   3 jellyfin jellyfin  4096 Aug 15 12:05 users/



RE: System.InvalidOperationException: There is an error in XML document (0, 0). - endymion1818 - 2024-01-03

To be clear, I upgraded Jellyfin _after_ this started to happen, to see if it would resolve the issue.


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - endymion1818 - 2024-01-03

Thanks @TheDreadPirate, I checked all XML files with an online validator and there were no errors ...

I wonder if it's system.xml that's the issue:

System.InvalidOperationException: There is an error in XML document (0, 0).
---> System.Xml.XmlException: Root element is missing.

But I wouldn't know what was the problem there.


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - TheDreadPirate - 2024-01-03

The quick solution is to

backup /var/lib/jellyfin (this has your database and user data)
uninstall
reinstall
stop jellyfin
restore /var/lib/jellyfin from the backup
start jellyfin


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - niels - 2024-01-03

If the root element is missing that likely means the file is empty.


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - Daniel_King - 2025-01-22

(2024-01-03, 09:40 AM)endymion1818 Wrote: System.InvalidOperationException: There is an error in XML document (0, 0).
---> System.Xml.XmlException: Root element is missing.

After updating my Linux server and deleting the docker log files, I get the same error.

Could you solve this issue?


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - TheDreadPirate - 2025-01-22

Is jellyfin installed directly on Linux or in Docker?

If directly on Linux, delete all the XMLs in /etc/jellyfin/. They will be recreated with defaults and don't contain any critical data.

If docker, navigate to where you mounted /config and delete all the XMLs in /config/config.


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - Daniel_King - 2025-01-22

I use Docker.

My config folder is mounted under "/home/jellyfin/config".

But within the config folder, there is no other config folder.

I see 4 xml files:
encoding.xml
migration.xml
network.xml
system.xml

Should I delete them, or are these other XMLs?

Edit: Removing the XMLs worked. Thanks!


RE: System.InvalidOperationException: There is an error in XML document (0, 0). - banked2678 - 2025-04-21

After some experimentation, I could get it working by deleting migration.xml and system.xml.

If one would like to fix this problem too, he can try deleting only these so that configs aren't lost unnecessarily.