Kareadita/Kavita · error · KavitaException

send-to-permission

Error message

send-to-permission

What it means

Thrown by DeviceService.SendTo when the selected files include a format other than Epub or Pdf AND the target device platform is Kindle. Kindle devices only accept epub and pdf files via email delivery; sending archives (CBZ, CBR, ZIP) or images to a Kindle is rejected by this guard.

Source

Thrown at Kavita.Services/DeviceService.cs:111

        {
            logger.LogError(ex, "There was an issue with deleting the device, {DeviceId} for user {UserName}", deviceId, userWithDevices.UserName);
        }

        return false;
    }

    public async Task<bool> SendTo(IReadOnlyList<int> chapterIds, int deviceId, CancellationToken ct = default)
    {
        var settings = await unitOfWork.SettingsRepository.GetSettingsDtoAsync(ct);
        if (!settings.IsEmailSetupForSendToDevice())
            throw new KavitaException("send-to-kavita-email");

        var device = await unitOfWork.DeviceRepository.GetDeviceById(deviceId, ct);
        if (device == null) throw new KavitaException("device-doesnt-exist");

        var files = await unitOfWork.ChapterRepository.GetFilesForChaptersAsync(chapterIds, ct);
        if (files.Any(f => f.Format is not (MangaFormat.Epub or MangaFormat.Pdf)) && device.Platform == EmailDevicePlatform.Kindle)
            throw new KavitaException("send-to-permission");

        // If the size of the files is too big
        if (files.Sum(f => f.Bytes) >= settings.SmtpConfig.SizeLimit)
            throw new KavitaException("send-to-size-limit");


        try
        {
            device.UpdateLastUsed();
            unitOfWork.DeviceRepository.Update(device);
            await unitOfWork.CommitAsync(ct);
        }
        catch (Exception ex)
        {
            logger.LogError(ex, "There was an issue updating device last used time");
        }

        var success = await emailService.SendFilesToEmail(new SendToDto()

View on GitHub (pinned to 9c3e540000)

Solutions

  1. Convert the files to EPUB or PDF format before sending to a Kindle device
  2. Select only chapters that are already in EPUB or PDF format when targeting a Kindle
  3. Use a non-Kindle device platform (e.g., a generic email device) that accepts other formats
  4. Set up a conversion pipeline (e.g., KCC - Kindle Comic Converter) to pre-process comic archives

Example fix

// Filter eligible files before presenting the send-to-device option:
// var eligibleFiles = files.Where(f =>
//   device.Platform == EmailDevicePlatform.Kindle
//     ? f.Format is MangaFormat.Epub or MangaFormat.Pdf
//     : true
// ).ToList();
// if (eligibleFiles.Count < files.Count) {
//   toast.warn('Some files are not supported on Kindle and were excluded');
// }
Defensive patterns

Strategy: validation

Validate before calling

// Filter eligible files before calling SendTo when target is Kindle:
// var files = await unitOfWork.ChapterRepository.GetFilesForChaptersAsync(chapterIds, ct);
// var device = await unitOfWork.DeviceRepository.GetDeviceById(deviceId, ct);
// if (device.Platform == EmailDevicePlatform.Kindle) {
//     var incompatible = files.Where(f => f.Format is not (MangaFormat.Epub or MangaFormat.Pdf)).ToList();
//     if (incompatible.Any()) {
//         return BadRequest($"Kindle only supports EPUB and PDF. Incompatible files: {string.Join(", ", incompatible.Select(f => f.FilePath))}");
//     }
// }

Try / catch

// try {
//     await deviceService.SendTo(chapterIds, deviceId, ct);
// } catch (KavitaException ex) when (ex.Message == "send-to-permission") {
//     return BadRequest(new { error = "Kindle devices only accept EPUB and PDF files. Please select compatible files." });
// }

Prevention

When it happens

Trigger: User selects chapters containing CBZ/CBR archives or image formats and sends them to a Kindle device; a mixed-format selection includes at least one non-epub/non-pdf file with a Kindle target.

Common situations: User has a manga library in CBZ/CBR format and tries to send to Kindle (Kindle doesn't support comic archives natively); user has mixed-format series and selects all chapters including non-supported formats.

Related errors


AI-assisted analysis of Kareadita/Kavita@9c3e540000 (2026-08-13). Data as JSON: /api/errors/8a80d2da0e353260. Report an issue: GitHub.