Skip to content

Notifications are not sent sometimes #3374

Description

@s0len

Description

I've used Claude with Fable 5 to debug this and found that MEDIA_AVAILABLE is never sent on PostgreSQL. Availability re-check runs while the media-save transaction is still open (race on ≤3.3.x, deterministic since v3.4.0).

When a scan flips a requested movie from PROCESSING to AVAILABLE on a PostgreSQL
deployment, the MEDIA_AVAILABLE notification is silently dropped. The request is still
marked COMPLETED and the media AVAILABLE, so everything looks processed, only the
notification is lost, with zero log output. On v3.4.0+ this happens on every
scanner-driven availability transition; on ≤3.3.x it was intermittent. SQLite is
unaffected, which I believe is why this has been hard to reproduce upstream (#1771 was
this same symptom on PostgreSQL, the thread even asks the reporter for their
PostgreSQL version).

I'm running a fix in production: afterUpdate queues the work on queryRunner.data
and a new MediaSubscriber.afterTransactionCommit flushes it after the real COMMIT
(guarded with isTransactionActive, since savepoint releases broadcast the same
event). The deferred run sees the committed AVAILABLE row and the notification
dispatches; awaits are preserved, and a rolled-back save discards its queued work.
Verified over multiple full-scan runs: every transition of a requested title notifies,
routine updates no-op cleanly. Happy to open a PR if this approach sounds right.

(For transparency: I reported this symptom before in #3213 with a diagnosis that was
wrong — the rebuttal there was correct about those mechanisms. This report is a
different mechanism, verified line-by-line, with the deterministic repro below.)

Version

3.4.1

Steps to Reproduce

  1. Run seerr v3.4.1 with DB_TYPE=postgres, Plex + Radarr configured, Discord (or any)
    agent enabled with the "Media Available" type, LOG_LEVEL=debug.
  2. Pick any movie that is already AVAILABLE in seerr and has a COMPLETED request.
  3. In the database, reset it to the pre-scan state:
    UPDATE media SET status = 3 WHERE id = <mediaId>;
    UPDATE media_request SET status = 2 WHERE id = <requestId>;
  4. Run the "Plex Full Library Scan" job from Settings → Jobs.
  5. The scan logs "Media for <title> exists. Changes were detected and the title will
    be updated.", the media returns to AVAILABLE and the request to COMPLETED — but no
    "Sending notification(s) for MEDIA_AVAILABLE" line ever appears and no notification
    is sent. Repeat as often as you like; on PostgreSQL it drops every time on v3.4.x.
    The same steps on SQLite produce the notification.

Screenshots

No response

Logs

2026-08-08T11:30:35Z [info][Notifications]: Sending notification(s) for MEDIA_AUTO_APPROVED {"subject":"Lawless (2012)"}
2026-08-08T11:30:35Z [debug][Notifications]: Sending Discord notification {"type":"MEDIA_AUTO_APPROVED","subject":"Lawless (2012)"}
... (Radarr downloads and imports; Plex picks the file up at its nightly library scan) ...
2026-08-08T23:05:00Z [info][Plex Scan]: Media for Lawless exists. Changes were detected and the title will be updated.
2026-08-08T23:05:04Z [info][Plex Scan]: Beginning to process recently added for library: Animeserier
    <-- no MEDIA_AVAILABLE, no error, nothing — the request is COMPLETED and the media AVAILABLE in the DB

With the after-commit fix applied, the same transition:

2026-08-10T19:30:06Z [debug][Media]: Deferred related request update until transaction commit {"mediaId":3949}
2026-08-10T19:30:06Z [info][Notifications]: Sending notification(s) for MEDIA_AVAILABLE {"subject":"Lawless (2012)"}
2026-08-10T19:30:06Z [debug][Notifications]: Sending Discord notification {"type":"MEDIA_AVAILABLE","subject":"Lawless (2012)"}

Platform

desktop

Database

PostgreSQL

Device

N/A

Operating System

Kubernetes (Talos)

Browser

N/A

Additional Context

No response

Search Existing Issues

  • Yes, I have searched existing issues.

Code of Conduct

  • I agree to follow Seerr's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions