hello, I changed the name of one my task from `get...
# prefect-community
h
hello, I changed the name of one my task from
get_timestamp()
to
init_flow_run()
. It runs fine with docker storage locally, but after I pushed the new flow to the prefect-cloud, I encountered this error
Copy code
Unexpected error while running flow: KeyError('Task slug init_flow_run-1 not found in the current Flow; this is usually caused by changing the Flow without reregistering it with the Prefect API.')
I pushed and registered the new docker storage with the following code
Copy code
flow.storage.build(push=True)

    flow.register(
        project_name='prefect-cloud-project-test`
        set_schedule_active=False
    )
prior to that, the storage is built with
Copy code
labels = [target_release, environment]

flow.environment = LocalEnvironment(labels=labels)

flow.storage = Docker(
    registry_url=registry_url,
    dockerfile='flow.Dockerfile',
    image_name=schedule_type,
    image_tag=target_release,
    env_vars={
      ....
    }
)
k
Hmm, interesting that your error indicates it's looking for a
init_flow_run-1
slug. Your newly built image is in your container registry after re-registering your flow to Cloud?
Also, it looks like you are hardcoding your image name and tag (which is perfectly valid), but sometimes Kubernetes will cache images based on name / tag. So your cluster might be referencing an old image.
h
the
init_flow_run
is the new task name, the
get_timestamp
is the old task name, do you suggest that the error indicates the new name is registered with prefect-cloud, but somehow is not found in the actual docker container when k8e agent execute it? So, it’s likely that the k8e job didn’t pull and use the correct version of docker image?
k
It's difficult to tell with the given information, but yes - this is a possible reason for the error you're seeing that others have encountered.