<@ULVA73B9P> The `prefect automation ls` command i...
# ask-marvin
j
@Marvin The
prefect automation ls
command is failing with the following stack trace:
Copy code
Traceback (most recent call last):
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/cli/_utilities.py", line 44, in wrapper
    return fn(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/cli/_types.py", line 156, in sync_fn
    return asyncio.run(async_fn(*args, **kwargs))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jason/.local/share/uv/python/cpython-3.12.10-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/jason/.local/share/uv/python/cpython-3.12.10-linux-x86_64-gnu/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jason/.local/share/uv/python/cpython-3.12.10-linux-x86_64-gnu/lib/python3.12/asyncio/base_events.py", line 691, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/events/cli/automations.py", line 36, in wrapper
    return await func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/events/cli/automations.py", line 50, in ls
    automations = await client.read_automations()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/client/orchestration/_automations/client.py", line 204, in read_automations
    return Automation.model_validate_list(response.json())
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/_internal/schemas/bases.py", line 64, in model_validate_list
    return validate_list(cls, obj)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/prefect/utilities/generics.py", line 18, in validate_list
    return [model.model_validate(item) for item in ListValidator.validate_python(input)]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/Users/jason.weiner/PycharmProjects/prefect-scripts/venv/lib/python3.12/site-packages/pydantic/main.py", line 705, in model_validate
    return cls.__pydantic_validator__.validate_python(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 17 validation errors for Automation
actions.1.DoNothing.type
  Input should be 'do-nothing' [type=literal_error, input_value='send-email-notification', input_type=str]
    For further information visit <https://errors.pydantic.dev/2.11/v/literal_error>
There are 16 more validation errors that do not fit in the context window.
m
thought for 365.9 seconds
Thanks for the stack trace — that helps. What’s happening - The CLI is fetching your automations and trying to deserialize each action into known Prefect action types. - Your API response includes an action with type
send-email-notification
, but the Prefect version installed in your environment doesn’t recognize that type. Pydantic then tries each known action model (e.g.,
DoNothing
) and fails, resulting in the “Input should be 'do-nothing'” error you’re seeing. - In current Prefect 3.x, the SDK exposes a generic
SendNotification
action (class
SendNotification
) in
prefect.events.actions
. If your workspace/server is returning
send-email-notification
, that indicates a version skew between your client and the server (Prefect Cloud or self-hosted). How to fix 1) Upgrade your local Prefect to the latest 3.x
Copy code
pip install -U prefect
# or with uv
uv pip install -U prefect
Then re-run:
Copy code
prefect automation ls
2) If you are self-hosting Prefect Server, make sure your server and client are on compatible versions. Upgrade the server to match your client if needed. 3) Quick workaround if you cannot upgrade immediately: - Edit or temporarily disable the automation that has the “send email notification” action from the UI so that
prefect automation ls
no longer has to parse that action. - Or manage automations from the UI until you can upgrade. Could you share: - The output of
prefect version
- Whether you’re using Prefect Cloud or self-hosted Server - If you recently added an “email notification” action via the UI Helpful links - Actions API (includes
SendNotification
and other actions): Prefect 3.x actions API - CLI reference for automations: prefect automation CLI If upgrading doesn’t resolve it, I can dig deeper — likely a schema mismatch we should patch.
j
@Marvin I am running Prefect 3.4.20 against Prefect Cloud. I was able to get a valid response from the command by deleting the Send Email action from the Automation where it was being used. The Automation with the
send-email-notification
action type was created on the server on September 28, 2025 - after the release of 3.4.20 - and the action works as expected.
m
thought for 163.6 seconds
Thanks for the extra context — that makes the picture clear. What’s going on - You’re on Prefect 3.4.20 (released Sep 25, 2025) against Prefect Cloud. - Cloud rolled out a new/updated automation action type that serializes as
send-email-notification
(your automation was created Sep 28, 2025). - The 3.4.20 Python client does not yet include that action type in its automation action union. When
prefect automation ls
deserializes the list, it hits that action and Pydantic raises because the type isn’t recognized — hence the ValidationError you saw. - Deleting the Send Email action removes the unrecognized type from the response, so
ls
works again. Next steps - We should treat this as a client/server schema mismatch bug. I’ll escalate so we can ship a patch release of the Python package that recognizes
send-email-notification
. - If you’re okay with it, I can open an issue on your behalf. If you prefer to file it yourself, include: - Prefect version: 3.4.20 - Environment: Prefect Cloud - Repro: Create an automation with the “Send Email” action in Cloud UI, then run
prefect automation ls
- Error: Pydantic ValidationError showing
Input should be 'do-nothing' ... got 'send-email-notification'
Workarounds until a patch is out - Use the UI to list/manage automations. - Use
prefect automation inspect
for specific automations you know by name/ID. It will still fail for any automation that includes the Send Email action, but will work for others:
Copy code
prefect automation inspect "my-automation"
  prefect automation inspect --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" --json
- If CLI listing is critical, you can temporarily exclude automations with the Send Email action (as you did) or query the REST API directly to bypass client-side model validation. If you’d like, I can share a curl snippet tailored to your account/workspace that uses your API key. References - Actions API (includes SendNotification and related action types): Actions API - Automation CLI: prefect automation CLI Would you like me to open the GitHub issue with the details you’ve shared and keep you posted on the fix?
j
@Marvin Open the bug
m
thought for 133.6 seconds
Thanks — I’ve opened a public GitHub discussion to track this bug and notified the team. Link: prefect/discussions/19076 Summary of the report - Prefect 3.4.20 against Prefect Cloud -
prefect automation ls
fails with a Pydantic ValidationError when any automation includes the Send Email action created in Cloud UI (serialized as
send-email-notification
) - Likely a client/server schema mismatch introduced after 3.4.20 - Requesting a patch release to recognize the new action type or gracefully handle unknown actions I’ll keep an eye on the discussion and update you as soon as there’s movement.