<#CL09KU1K7|> Hello All, I see below error ```ra...
# ask-community
b
#CL09KU1K7 Hello All, I see below error
Copy code
raise DeploymentApplyError(
prefect.deployments.runner.DeploymentApplyError: Error while applying deployment: Client error '422 Unprocessable Entity' for url 'https://*******/api/deployments/'
Response: {'exception_message': 'Invalid request received.', 'exception_detail': [{'type': 'extra_forbidden', 'loc': ['body', 'schedules', 0, 'slug'], 'msg': 'Extra inputs are not permitted', 'input': None}], 'request_body': {'name': 'Bharat Automation', 'flow_id': 'ba5b9e26-3bde-4820-af2d-19ade97c1d9b', 'paused': False, 'schedules': [{'schedule': {'cron': '30 */4 * * *', 'timezone': None, 'day_or': True}, 'active': True, 'max_scheduled_runs': None, 'parameters': {}, 'slug': None}], 'concurrency_limit': 1, 'concurrency_options': None, 'enforce_parameter_schema': True, 'parameter_openapi_schema': {'title': 'Parameters', 'type': 'object', 'properties': {}}, 'parameters': {}, 'tags': [], 'labels': {}, 'pull_steps': [{'prefect.deployments.steps.set_working_directory': {'directory': '/home/bkhaneja'}}], 'work_queue_name': None, 'work_pool_name': 'cla-infra', 'storage_document_id': None, 'infrastructure_document_id': None, 'description': 'None', 'path': None, 'version': '6248918156128180d3c40b3bd89e2025', 'entrypoint': 'test6.py:automation_executor', 'job_variables': {}}}
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422 my script is simple like this, it works for first time but on seciond time it gives this error..
Copy code
from prefect import flow, task
from prefect_shell import ShellOperation
from pathlib import Path

@task
def run_script(command: str):
    shell_op = ShellOperation(commands=[command])
    return shell_op.run()

# Flow for Bharat Automation Job
@flow(name="Bharat Automation Flow")
def automation_executor():
    command = "/usr/bin/python3.9 *****"
    run_script(command)

# Deploy all flows to Prefect server with schedules
if __name__ == "__main__":
    automation_executor.from_source(
        source=str(Path(__file__).parent.resolve()),
        entrypoint=f"{Path(__file__).name}:automation_executor",
    ).deploy(name="Bharat Automation", work_pool_name="bk-infra", cron="30 */4 * * *", concurrency_limit=1)
(earlier on running it for second time was not causing any issue, started seeing this after prefect upgrade)
Can someone from Prefect please assist.. or @Marvin
m
It seems like you might be looking for assistance with Prefect. While I'm not a human from Prefect, I can certainly help you with any questions or issues you might have related to Prefect. Whether you need help with specific features, understanding the API, or troubleshooting, feel free to let me know what you need assistance with!
b
Hey Bharat! Have you confirmed that the Prefect version is the same for the server and the flow's environment?
you can check that by running
prefect version
You may consider upgrading your python version too. I see you're using 3.9, someone else was able to get past a similar error by upgrading to Python version 3.11.
b
Copy code
# prefect version
Version:             3.2.6
API version:         0.8.4
Python version:      3.9.20
Git commit:          5ceb3ada
Built:               Wed, Feb 19, 2025 9:24 PM
OS/Arch:             linux/x86_64
Profile:             ephemeral
Server type:         server
Pydantic version:    2.10.6
Integrations:
  prefect-shell:     0.3.1
its same across both the environments
@Bianca Hoch Do you really think upgrading python will help ?
b
It helped here. If that doesn't work, there's always other things to try. That's the beauty of debugging 😅
b
@Bianca Hoch It resolved my issue, thank you so much.
🙌 1
On the latest prefect and python3.11 now
Copy code
# prefect version
Version:             3.2.6
API version:         0.8.4
Python version:      3.11.11
Git commit:          5ceb3ada
Built:               Wed, Feb 19, 2025 9:24 PM
OS/Arch:             linux/x86_64
Profile:             ephemeral
Server type:         server
Pydantic version:    2.10.6
Integrations:
  prefect-shell:     0.3.1
prefect spin 1
b
No problem Bharat! Glad to hear you're unblocked now 🙌