Radarr/Radarr · error · UnsupportedMediaTypeException

Invalid extension, must be one of: {ValidExtensions.Join(",

Error message

Invalid extension, must be one of: {ValidExtensions.Join(", ")}

What it means

Thrown as an UnsupportedMediaTypeException (HTTP 415) by the POST /api/v3/system/backup/restore/upload endpoint when the uploaded multipart file's extension is not in the hardcoded whitelist {".zip", ".db", ".xml"}. Radarr only restores archives in the three formats its own backup writer produces. The check at BackupController.cs:106-110 uses Path.GetExtension(file.FileName) (which includes the leading dot and returns "" for extensionless names) tested with List<string>.Contains, a case-sensitive comparison, so an uppercase extension like .ZIP or .Xml also fails.

Source

Thrown at src/Radarr.Api.V3/System/Backup/BackupController.cs:110

        }

        [HttpPost("restore/upload")]
        [RequestFormLimits(MultipartBodyLengthLimit = 5000000000)]
        public object UploadAndRestore()
        {
            var files = Request.Form.Files;

            if (files.Empty())
            {
                throw new BadRequestException("file must be provided");
            }

            var file = files[0];
            var extension = Path.GetExtension(file.FileName);

            if (!ValidExtensions.Contains(extension))
            {
                throw new UnsupportedMediaTypeException($"Invalid extension, must be one of: {ValidExtensions.Join(", ")}");
            }

            var path = Path.Combine(_appFolderInfo.TempFolder, $"radarr_backup_restore{extension}");

            _diskProvider.SaveStream(file.OpenReadStream(), path);
            _backupService.Restore(path);

            // Cleanup restored file
            _diskProvider.DeleteFile(path);

            return new
            {
                RestartRequired = true
            };
        }

        private string GetBackupPath(NzbDrone.Core.Backup.Backup backup)
        {

View on GitHub (pinned to ca451608dc)

Solutions

  1. Rename the file so its extension is exactly one of .zip, .db, or .xml, all lowercase (e.g. mybackup.zip).
  2. If the file is a .tar.gz or other archive, repackage it as a .zip before upload.
  3. Confirm the extension is truly lowercase by checking with `ls` or `dir`; macOS/Windows 'hide extensions' can mask a .ZIP rename.
  4. If you genuinely need a new backup format supported, add it to the ValidExtensions list in src/Radarr.Api.V3/System/Backup/BackupController.cs:23 and ensure _backupService.Restore can parse it.

Example fix

// before: uploading radarr_backup_2024.BAK -> 415 Invalid extension
// after: rename the file and re-upload
cp radarr_backup_2024.BAK radarr_backup_2024.zip
curl -X POST http://localhost:7878/api/v3/system/backup/restore/upload \
  -H "X-Api-Key: $API_KEY" \
  -F "file=@radarr_backup_2024.zip"
Defensive patterns

Strategy: validation

Validate before calling

// Client-side: check the file extension before posting
var allowed = new[] { ".zip", ".db", ".xml" };
var ext = Path.GetExtension(filePath).ToLowerInvariant(); // mirror the server's lowercase whitelist
if (!allowed.Contains(ext))
{
    throw new InvalidOperationException(
        $"File extension '{ext}' not supported. Allowed: {string.Join(", ", allowed)}");
}
// then upload
using var form = new MultipartFormDataContent();
using var fs = File.OpenRead(filePath);
form.Add(new StreamContent(fs), "file", Path.GetFileName(filePath));
var resp = await client.PostAsync("api/v3/system/backup/restore/upload", form);

Prevention

When it happens

Trigger: Uploading a backup file with no extension (Path.GetExtension returns ""), a wrong extension (.bak, .tar, .7z), or a compound extension where only the last segment is inspected (.tar.gz yields ".gz"). Also any uppercase variant such as .ZIP, .DB, .XML because List<string>.Contains is ordinal/case-sensitive and the whitelist is all-lowercase.

Common situations: Restoring a backup downloaded from another Radarr instance that was renamed during transfer; restoring a manually zipped archive produced by a different tool; OS-level 'hide extensions' settings causing a user to append .zip to a file already named .zip (producing .zip.zip, which still passes); cross-platform restores where the file got a capitalized extension through a GUI rename.

Related errors


AI-assisted analysis of Radarr/Radarr@ca451608dc (2026-08-13). Data as JSON: /api/errors/c834265ca6637831. Report an issue: GitHub.