Looks like every time when a deployment happens on the environment using CI/CD process, a new Flow version is created, which leads to an error

Flow Version Limit Exceeded, Details: You can only have 50 versions per flow.

How this error can be fixed or avoided?

If we try to delete the flow,

sf project delete source -r -m Flow:VeryPopularFlowWithTooManyFlowVersions

we receive another error

Component Failures [1]
| Type  Name                     Problem                                          
| ───── ──────────────────────── ──────────────────────────────────────────────── 
| Error VeryPopularFlowWithTooManyFlowVersions insufficient access rights on cross-reference id 

1 Answer 1


We can create a script deleteFlow.sh to try to delete all versions it finds, starting from v1 and ending v50

for i in {1..50}; do 
    sf project delete source -r -m Flow:$1-$i 

and then just execute

./deleteFlow.sh VeryPopularFlowWithTooManyFlowVersions

  • Is this doing something to avoid deleting the currently active version? Can you explain how it does?
    – Phil W
    Commented May 28 at 10:57
  • trying to delete all versions it finds, starting from v1 and ending v50... I guess this wouldn't be able to delete the currently active version but for my case I don't care since CI/CD will deploy the new active version of the flow....
    – Patlatus
    Commented May 28 at 12:18
  • Please edit the answer to make that clear.
    – Phil W
    Commented May 28 at 12:22
  • @PhilW ok, updated
    – Patlatus
    Commented May 28 at 15:54
  • That edit does not warn people that this might delete all versions, or explain that an active version cannot be deleted (if that is the case). Please be absolutely clear as to what the end result is in explaining the behaviour of your script.
    – Phil W
    Commented May 28 at 16:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .