File does not contain a valid CIL image

Sonarr version (exact version):
Mono version (if Sonarr is not running on Windows):
OS: Ubuntu 20.04 x64
Debug logs:
Description of issue:
Frequently when running sonarr after a system restart I get the following error:

/usr/bin/mono --debug /usr/lib/sonarr/bin/Sonarr.exe -nobrowser -data=/home/smokescreen/.sonarr/data
Cannot open assembly ‘/usr/lib/sonarr/bin/Sonarr.exe’: File does not contain a valid CIL image.

The only way I can get sonarr to run again is by removing it via apt then installing it again. I havent found any other fixes to get it running. Google searches dont give me much either.

Any suggestions?

I’d start by checking the file before/after the re-install, is the size/hash different? It sounds like it’s getting corrupted, I don’t recall seeing this issue before.

1 Like

Thanks for the pointer - I have checked md5 + filesize and your hunch was correct. The md5 changes after a uninstall/reinstall and the file has a size of 0 when it doesnt work.

Any idea what could be causing this? It happens consistently with sonarr. I have other programs that run via the same start methods (lidarr, radarr, jackett, qbittorrent, lazy librarian) and do not experience any corruption with them, sonarr’s configs or the system in general. The VM they run on are always sht down cleanly. I cant think of anything that could be causing it.

Any suggestions? I’m stumped…

I haven’t seen this happen before and not sure what could be causing it.

One thing you could try:

  • Reboot the server
  • Get Sonarr running
  • Reboot

Does it start back up properly?
If so, need to narrow down when it breaks, for that, I’d check and see if Sonarr has tried to update (via debug/trace logs and the update logs).