<@ULVA73B9P> I using prefect client to read_flow_r...
# ask-marvin
w
@Marvin I using prefect client to read_flow_runs like this:
Copy code
async with prefect.get_client() as client:

            flow_runs = await client.read_flow_runs(
                flow_run_filter=FlowRunFilter(
                    name=FlowRunFilterName(any_=["MY_RUN"]),
                ),
                sort=FlowRunSort.START_TIME_DESC,
            )
Which sends this request with this json content
Copy code
METHOD: POST
JSON = {
deployments: None, 
flow_runs: {
name: {
any_: ["MY_RUN"]
}
}, 
flows: None, 
limit: None, 
offset: 0, 
sort: FlowRunSort.START_TIME_DESC, 
task_runs: None, 
work_pool_queues: None, 
work_pools: None
}
But I got the following stacktrace
Copy code
PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url '<https://my_local_prefect_instance.com/api/flow_runs/filter>'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'loc': ['path', 'id'], 'msg': 'value is not a valid uuid', 'type': 'type_error.uuid'}], 'request_body': None}
Do you know what could be happening here? How can I debug this issue? Any recommendation, settings to activate or some path to chase?
👀 1
m
Your message was too long by 196 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
I using prefect client to read_flow_runs like this:
Copy code
async with prefect.get_client() as client:

            flow_runs = await client.read_flow_runs(
                flow_run_filter=FlowRunFilter(
                    name=FlowRunFilterName(any_=["MY_RUN"]),
                ),
                sort=FlowRunSort.START_TIME_DESC,
            )
Which sends this request with this json content
Copy code
METHOD: POST
JSON = {
deployments: None, 
flow_runs: {
name: {
any_: ["MY_RUN"]
}
}, 
flows: None, 
limit: None, 
offset: 0, 
sort: FlowRunSort.START_TIME_DESC, 
task_runs: None, 
work_pool_queues: None, 
work_pools: None
}
But I got the following stacktrace ```PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'https://my_local_prefect_instance.com/api/flow_runs/filter' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'loc': ['path', 'id'], 'msg': 'value is not a valid uuid', 'type': 'type_error.uuid'}], 'request_body': None} For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 File "incrementality/clients/incrementality_prefect_client.py", line 23, in get_flow_run_messages flow_runs = await client.read_flow
Your message was too long by 180 tokens - please shorten it and try again. For reference, here's your message at the allowed limit:
I using prefect client to read_flow_runs like this:
Copy code
async with prefect.get_client() as client:

            flow_runs = await client.read_flow_runs(
                flow_run_filter=FlowRunFilter(
                    name=FlowRunFilterName(any_=["MY_RUN"]),
                ),
                sort=FlowRunSort.START_TIME_DESC,
            )
Which sends this request with this json content
Copy code
METHOD: POST
JSON = {
deployments: None, 
flow_runs: {
name: {
any_: ["MY_RUN"]
}
}, 
flows: None, 
limit: None, 
offset: 0, 
sort: FlowRunSort.START_TIME_DESC, 
task_runs: None, 
work_pool_queues: None, 
work_pools: None
}
But I got the following stacktrace ```PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'https://my_local_prefect_instance.com/api/flow_runs/filter' Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'loc': ['path', 'id'], 'msg': 'value is not a valid uuid', 'type': 'type_error.uuid'}], 'request_body': None} For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 File "prefect_client.py", line 23, in get_flow_run_messages flow_runs = await client.read_flow_runs( File "prefect
It appears that your issue may be related to the structure of the request you're sending, specifically when it comes to filtering flow runs. The error message you're encountering indicates the server expects a UUID but received something else. In this case, it could be due to an incorrect path parameter or request body structure. While I couldn't find a snippet directly addressing your error from the Prefect documentation or GitHub issues, I can suggest a few steps you can take to debug this issue: 1. Ensure that you're using the correct endpoint and request body structure. The Prefect Orion API expects UUIDs for filtering specific resources. Review the Using the Client section of the Prefect documentation to ensure you're constructing the request correctly. 2. Double-check the Prefect server URL and confirm that it is accessible from your environment. Network issues or incorrect URLs could result in unexpected responses. 3. Validate that you're using the correct field names in your JSON. For instance, instead of
FlowRunFilterName
, you might need to use
FlowRunFilterId
if you're trying to filter by specific IDs. 4. Update your Prefect client to the latest version. There might be updates or fixes that address the issue you're facing. 5. Enable logging for the Prefect client to get more detailed information on the request and response. This could provide insight into what part of the request is being rejected by the server. 6. Review open and closed issues on the Prefect GitHub repository to see if others have encountered similar problems and to check for any related bug reports or fixes. 7. If none of the above steps help, consider reaching out to the Prefect community or Prefect support for further assistance. Remember that I'm here to assist you. If existence is meaningless, at least let's make sure our API calls are error-free.