Brandon Robertson
10/13/2025, 6:38 PMfrom prefect.blocks.notifications import PagerDutyWebhook
pagerduty_webhook_block = PagerDutyWebhookBlock.load("my-pager-duty-block)
I'm getting this error:
File ".venv/lib/python3.13/site-packages/prefect/blocks/notifications.py", line 41, in __init__ NOTIFY_TYPES += (PREFECT_NOTIFY_TYPE_DEFAULT, ) # pyright: ignore[reportUnknownVariableType]
TypeError: unsupported operand type(s) for +=: 'frozenset' and 'tuple'
I'm using prefect version 3.4.0
Any suggestions?Marvin
10/13/2025, 6:38 PMMarvin
10/13/2025, 6:42 PMNOTIFY_TYPES += (...).
- Newer Apprise versions changed NOTIFY_TYPES to a frozenset (immutable), so the += throws TypeError: unsupported operand type(s) for +=: 'frozenset' and 'tuple'.
Also, a quick naming note: in Prefect 3.x the class is PagerDutyWebHook (capital H) and there is no PagerDutyWebhookBlock class name. Loading the block should look like this:
from prefect.blocks.notifications import PagerDutyWebHook
pd = PagerDutyWebHook.load("my-pager-duty-block")
How to fix
- Best fix: upgrade to the latest Prefect 3.4.x, which includes multiple compatibility improvements and bugfixes.
- pip install -U prefect
- Release notes: Prefect releases
- If you need to stay on Prefect 3.4.0: pin Apprise to an earlier version where NOTIFY_TYPES was still mutable. I don’t want to guess the exact version without your environment details — could you share pip show apprise? I can confirm a safe pin once I know the version you’re on.
Reference docs
- Blocks in Prefect 3: Blocks concept docs
If you upgrade Prefect and still see the error, let me know your Apprise version and I’ll suggest a precise pin.Brandon Robertson
10/13/2025, 6:45 PMName: apprise
Version: 1.9.5
Summary: Push Notifications that work with just about every platform!
Requires: certifi, click, markdown, PyYAML, requests, requests-oauthlib
Required-by: prefectMarvin
10/13/2025, 6:45 PMMarvin
10/13/2025, 6:46 PMNOTIFY_TYPES is a frozenset (immutable), and Prefect 3.4.0’s notifications module tries to extend it with +=, which raises the TypeError you’re seeing.
Also, a quick naming fix: in Prefect 3.x the class is PagerDutyWebHook (capital H), and you load it directly from the class (there’s no PagerDutyWebhookBlock class). For example:
from prefect.blocks.notifications import PagerDutyWebHook
pd = PagerDutyWebHook.load("my-pager-duty-block")
You’re on Apprise 1.9.5. Here are two ways to get unblocked:
- Option A: Upgrade Prefect to the latest 3.4.x
- This includes various compatibility improvements and may avoid this issue.
- Command:
pip install -U prefect
- Releases: Prefect releases
- Option B: Pin Apprise below 1.9.5 (roll back the change that made NOTIFY_TYPES immutable)
- Command:
pip install "apprise<1.9.5"
- If you still hit the error, try an earlier minor series:
pip install "apprise>=1.8,<1.9"
Docs for reference: Blocks in Prefect 3
Give one of those a try and let me know if the error persists. If you prefer not to change Prefect right now, pinning Apprise below 1.9.5 is the quickest workaround.