Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a flow from a deployment using prefect client is failing due to an extra input field "labels" #16672

Open
jiohyoo opened this issue Jan 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jiohyoo
Copy link

jiohyoo commented Jan 10, 2025

Bug summary

Starting from prefect version 3.1.11, the creating a flow run from a deployment fails with the following error.

main $ pip freeze | grep prefect
prefect==3.1.11
prefect-ray==0.4.3

main $ prefect deployment run 'retry-flow/retry_flow'
Creating flow run for deployment 'retry-flow/retry_flow'...
Traceback (most recent call last):
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/cli/_utilities.py", line 43, in wrapper
    return fn(*args, **kwargs)
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/cli/_types.py", line 155, in sync_fn
    return asyncio.run(async_fn(*args, **kwargs))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/cli/deployment.py", line 857, in run
    flow_run = await client.create_flow_run_from_deployment(
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/client/orchestration/__init__.py", line 681, in create_flow_run_from_deployment
    response = await self._client.post(
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/httpx/_client.py", line 1859, in post
    return await self.request(
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/httpx/_client.py", line 1540, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/client/base.py", line 355, in send
    response.raise_for_status()
  File "/home/ubuntu/prefect-poc/.venv/lib/python3.10/site-packages/prefect/client/base.py", line 163, in raise_for_status
    raise PrefectHTTPStatusError.from_httpx_error(exc) from exc.__cause__
prefect.exceptions.PrefectHTTPStatusError: Client error '422 Unprocessable Entity' for url 'http://127.0.0.1:4200/api/deployments/9c692ce5-0945-490a-9f05-5101511c8152/create_flow_run'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'labels'], 'msg': 'Extra inputs are not permitted', 'input': {}}], 'request_body': {'state': {'type': 'SCHEDULED', 'name': 'Scheduled', 'message': None, 'state_details': {'scheduled_time': '2025-01-10T00:21:18.168599Z', 'traceparent': None}, 'data': None}, 'name': None, 'parameters': {}, 'context': {}, 'tags': [], 'idempotency_key': None, 'parent_task_run_id': None, 'job_variables': {}, 'labels': {}}}
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422
An exception occurred.

Even though the labels is not provided in creating object DeploymentFlowRunCreate, the labels is initialized with {} and this is not accepted in the server since:

    labels: KeyValueLabelsField = Field(default_factory=dict)

https://github.com/PrefectHQ/prefect/blob/main/src/prefect/client/schemas/actions.py#L400

Version info

Version:             3.1.11
API version:         0.8.4
Python version:      3.10.14
Git commit:          e448bd34
Built:               Thu, Jan 2, 2025 1:11 PM
OS/Arch:             linux/x86_64
Profile:             ephemeral
Server type:         server
Pydantic version:    2.10.4
Integrations:
  prefect-ray:       0.4.3

Additional context

No response

@jiohyoo jiohyoo added the bug Something isn't working label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant