Amir Kamal
08/29/2025, 4:12 AMEncountered exception during execution:
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/prefect/engine.py", line 2169, in orchestrate_task_run
result = await call.aresult()
^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 327, in aresult
return await asyncio.wrap_future(self.future)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 352, in _run_sync
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/liva/projects/prefect-agent/data-science-main/flows/dbt/tasks.py", line 38, in send_freshness_alert
webhook = SlackWebhook.load(block_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/utilities/asyncutils.py", line 311, in coroutine_wrapper
return call()
^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 432, in __call__
return self.result()
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 318, in result
return self.future.result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 179, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/usr/local/lib/python3.11/site-packages/prefect/_internal/concurrency/calls.py", line 389, in _run_async
result = await coro
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/client/utilities.py", line 100, in with_injected_client
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/blocks/core.py", line 844, in load
return cls._from_block_document(block_document)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/prefect/blocks/core.py", line 642, in _from_block_document
block = block_cls.parse_obj(block_document.data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "pydantic/main.py", line 532, in pydantic.main.BaseModel.parse_obj
File "/usr/local/lib/python3.11/site-packages/prefect/blocks/notifications.py", line 44, in __init__
apprise.NOTIFY_TYPES += (PREFECT_NOTIFY_TYPE_DEFAULT,)
TypeError: unsupported operand type(s) for +=: 'frozenset' and 'tuple'
Marvin
08/29/2025, 4:13 AMMarvin
08/29/2025, 4:17 AMNOTIFY_TYPES
as a frozenset (immutable). That +=
on a frozenset causes the TypeError.
Why this happens:
- Recent Apprise versions (v1.9.4+) introduced breaking changes (e.g., NotifyType
became an Enum and NOTIFY_TYPES
is immutable).
- Older Prefect versions attempted to patch Apprise types at runtime (e.g., apprise.NOTIFY_TYPES += (...)
), which now fails.
Fixes:
- Recommended: Upgrade Prefect to a version that removed this patching and aligned with new Apprise behavior (3.4.14 or newer).
- Release notes mention a related fix: Prefect 3.4.14 Release Notes
- PR with context: Fix apprise notifications with new Apprise behavior
- Alternative: Pin Apprise to a pre-change version (<= 1.9.3).
Commands:
# See what you have installed
python -c "import prefect, apprise; print('prefect:', prefect.__version__, 'apprise:', apprise.__version__)"
# Upgrade Prefect (preferred)
pip install -U prefect
# OR pin Apprise if you cannot upgrade Prefect yet
pip install 'apprise<1.9.4'
Quick test after upgrading:
from prefect.blocks.notifications import SlackWebhook
SlackWebhook.load("YOUR_BLOCK_NAME").notify("Test from Prefect")
If you share your current versions of Prefect and Apprise, I can confirm the exact path forward.Amir Kamal
08/29/2025, 4:20 AMAmir Kamal
08/29/2025, 4:20 AMMarvin
08/29/2025, 4:20 AMMarvin
08/29/2025, 4:20 AM[project]
name = "your-project"
version = "0.1.0"
dependencies = [
"prefect>=3.0.0",
"apprise==1.9.3",
]
Poetry
[tool.poetry.dependencies]
python = ">=3.11,<3.13"
prefect = "^3.0.0"
apprise = "1.9.3"
After editing, re-lock and install:
- Poetry: poetry update apprise
(or poetry lock && poetry install
)
- PDM: pdm update apprise
- uv: uv add apprise==1.9.3
or uv sync
- Pip + build backend: pip install -U "apprise==1.9.3"
Verify:
python -c "import prefect, apprise; print('prefect:', prefect.__version__, 'apprise:', apprise.__version__)"
Context on the issue (if helpful):
- Prefect fix: PR 18720
- Release with related notifications fixes: Prefect 3.4.14
If you tell me which tool you’re using (Poetry, PDM, Hatch, uv), I can tailor the exact steps.