<@ULVA73B9P> Why am I getting this error when call...
# ask-marvin
n
@Marvin Why am I getting this error when calling read_deployments? prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://server:4200/api/deployments/filter' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'deployments', 'is_schedule_active'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'flows': None, 'flow_runs': None, 'task_runs': None, 'deployments': {'operator': 'and_', 'id': None, 'name': None, 'paused': None, 'is_schedule_active': None, 'tags': {'operator': 'and_', 'all_': ['XXX'], 'is_null_': None}, 'work_queue_name': None}, 'work_pools': None, 'work_pool_queues': None, 'limit': None, 'offset': 0, 'sort': None}}
m
The error you're encountering,
Client error '422 Unprocessable Entity'
, occurs because the request to the Prefect server contains unexpected fields. The specific error detail
extra_forbidden
suggests that the server does not recognize or allow certain inputs in the request body, specifically
is_schedule_active
. From the research, it appears that there have been some changes and restrictions on the allowed fields in the request body when using Prefect's API to read deployments. To resolve this, you should ensure that your request only includes the fields permitted by the Prefect version you are using. Here's what you can do: 1. Check Your Request Body: Ensure the request body does not contain the
is_schedule_active
field or any other fields that might not be allowed. 2. Reference the Correct Documentation: Make sure you are following the latest API specifications for the version of Prefect you are using. The structure of allowed fields can sometimes change between versions. For Prefect 2.x, you can refer to: https://docs-2.prefect.io For Prefect 3.x, you can refer to: https://docs-3.prefect.io If you are following a tutorial or documentation, ensure that it's meant for your specific version of Prefect. If your issue persists after this adjustment, please let me know your Prefect version or any other specific details, and I will further assist you.
n
@Marvin The code that is calling the read_deployments is on Prefect 2.0, while the server is on 3.0. Is that a problem?
m
Yes, running a Prefect 2.x client with a Prefect 3.x server is likely causing the compatibility issue you are experiencing. Prefect aims to maintain backwards compatibility, but it always recommends using the same version or older versions of clients with a given server. From the documentation: - Prefect 2.x Docs: Prefect aims to maintain backward compatibility with old clients for each server release. It is recommended that all clients be the same version as the server or older. (Link) - Prefect 3.x Docs: Sometimes you cannot use new clients with an old server and vice versa due to expected capabilities. Prefect recommends that all clients be the same version as the server or older. (Link) ### Solution: To resolve this issue, you should either: 1. Upgrade your client to match the server's version (Prefect 3.x): This will ensure compatibility and access to the latest features and APIs. 2. Downgrade your server to match the client's version (Prefect 2.x): If upgrading the client is not feasible, aligning the server version to the client's version is another solution. For your specific case, upgrading the client to Prefect 3.x would be the recommended approach to avoid any compatibility issues and to take advantage of the latest features and improvements.