<@ULVA73B9P> i have a deployment with a tag "produ...
# ask-marvin
o
@Marvin i have a deployment with a tag "production" that's scheduled runs seem to end up not being created with the same tag. Any ideas?
m
thought for 627.4 seconds
Short answer: runs created from a deployment should inherit that deployment’s tags in Prefect 3.x. If your scheduled runs don’t have the “production” tag, it’s usually due to versioning or timing. A few things to check: - Deployment versioning: Tags are versioned in Prefect 3.x. If you added/changed the tag recently, make sure the active deployment version (the one your schedule is attached to) actually has
production
. You can verify with:
Copy code
prefect deployment inspect <FLOW_NAME>/<DEPLOYMENT_NAME>
- Pre-created scheduled runs: The scheduler creates runs ahead of time. If you changed tags after those runs were created, they’ll keep the old tags. Clear and regenerate upcoming scheduled runs:
Copy code
prefect deployment schedule clear <FLOW_NAME>/<DEPLOYMENT_NAME>
then resume the schedule. - Compare manual vs scheduled: Trigger a manual run and see if it inherits the tag:
Copy code
prefect deployment run <FLOW_NAME>/<DEPLOYMENT_NAME>
If manual runs have the tag but scheduled ones don’t, it’s almost certainly a “pre-created runs” or “wrong deployment version” situation. - Other triggers: If you have automations/webhooks calling the API or
run_deployment
and explicitly passing
tags=[...]
, those tags will be used instead of the deployment’s. Make sure nothing is overriding tags for those runs. How to ensure tags are set on the deployment: - In code (3.x):
Copy code
from prefect import flow

  @flow
  def my_flow():
      ...

  if __name__ == "__main__":
      my_flow.from_source(".").deploy(
          name="my-deploy",
          tags=["production"]
      )
- In the UI: Edit the deployment, add the tag, and save (this creates a new version with the updated tags). Docs for reference: - Deployments and tags: Deployments (Prefect 3) - Schedules: Schedules - API note: creating runs from deployments uses the deployment’s tags when tags aren’t provided explicitly: Create flow run from deployment If you can share: - Your Prefect version - How you set the tag (UI, code, or prefect.yaml) - Whether manual runs inherit the tag while scheduled runs don’t - A recent run id that’s missing the tag …I can help pinpoint the exact cause and the quickest fix.
o
@Marvin so i recently added tags to the deployment, and it was schedueld before. I assume previously generated scheduled runs then. If i understand correctly, that issue should just resolve itself with some more time/runs as well, i dont have to do anything if i am okay with a few more runs being "tagless"?
m
thought for 8.8 seconds
Yes—your read is right. - The scheduler pre-creates upcoming runs. Any runs that were created before you added the
production
tag will keep their old (tagless) state. - As new runs are generated by the scheduler, they’ll inherit the deployment’s current tags automatically. If you’re okay with a few tagless runs, you don’t need to do anything. If you want to fix it immediately, clear and regenerate upcoming runs:
Copy code
prefect deployment schedule clear <FLOW_NAME>/<DEPLOYMENT_NAME>
Then the scheduler will create new future runs with the updated tags. You can also verify by triggering a manual run:
Copy code
prefect deployment run <FLOW_NAME>/<DEPLOYMENT_NAME>
Refs: - Deployments and tags: Deployments (Prefect 3) - Schedules: Schedules