Flow save failed with code ‘InvalidPaginationPolicy’ – configure threshold limit more 5000 items

Fixed: Flow save failed with code ‘InvalidPaginationPolicy’ – configure threshold limit more 5000 items

No comments

Loading

In this Power Automate troubleshooting tutorial, we will learn how to fix the error “Flow save failed with code ‘InvalidPaginationPolicy’ and message ‘The pagination policy of workflow run action ‘Get_items_2’ of type ‘OpenApiConnection’ at line ‘1’ and column ‘1354’ is not valid. The value specified for property ‘minimumItemsCount’ exceeds the maximum allowed. Actual: ‘100000’. Maximum: ‘5000’.’.”

Issue Details: Flow save failed with code ‘InvalidPaginationPolicy’

The Flow save will fail with the error code “InvalidPaginationPolicy” and the message “The pagination policy of workflow run action error in Get Items, Get Files (Properties Only), or whichever action has the pagination and threshold limit settings.”

Flow save failed with code 'InvalidPaginationPolicy'
Flow save failed with code ‘InvalidPaginationPolicy’

The threshold should be a number greater than 0 and less than or equal to 100000.

If we go to the Get Items settings, enable the pagination, then enter the threshold limit value greater than 5000, we will get the above error, even though the threshold limit configuration clearly says that we can enter a value here from 0 to 0.1 million.

The threshold should be a number greater than 0 and less than or equal to 100000.
The threshold should be a number greater than 0 and less than or equal to 100000.

We can enter a number greater than 5000, but while saving the flow, we will get the above error: “Flow save failed with code “InvalidPaginationPolicy”.” This will not allow us to save the flow. This is really frustrating.

By the way, what does this threshold configuration mean?

For example, your list or document library has 60,000 items, and you want to retrieve all 60,000 items for further processing in the loop. As SharePoint has a threshold limit of 5000 items, if we don’t configure the pagination with a threshold limit, we will only get 5000 items by passing the top count as 5000.

However, by configuring the pagination along with the threshold limit, we will get all items from the list or document library (up to a maximum of 0.1 million) with a single query.

Now, coming to the main problem, why does the threshold limit not allow you to configure more than 5000 items?

Flow type that allows or does not allow more than the 5,000 threshold limit

From our experience, we will be able to configure more than the 5000 threshold limit in the manually triggered Power Automate flow but not in the automated cloud flow, where the maximum limit is 5000 due to the license issue.

A higher license is required for threshold limit configurations of more than 5000 items

In order to configure the threshold limit to more than 5000 items in the pagination settings, we need a flow premium plan (Plan 1 or Plan 2).

Power Automate flow Performance profiles

As per Microsoft “Flows have different limits depending on their performance profile. There are three possible values, depending on the flow owner’s plan.”

Power Automate flow Performance profiles
Power Automate flow Performance profiles – Reference URL: Limits for automated, scheduled, and instant flows

Exceptional cases where a flow returns all items with the 5000 threshold limit configuration

We don’t know why and how this happened. We have referred to a YouTube video where many people raised this concern about the 5000 limit threshold configuration. The author of the video says even though you are getting this limit, just pass the 4999 and you will get all items from the list.

We have just tried this: we configured the 5000 threshold limit in the pagination where we were getting the threshold limit error (more than 5000) and set the top count as 5000. Then, running the flow, we were able to get all items; it had more than 10,000 items.

We were surprised to see this and really still wonder based on how this 5000 threshold limit works. Still, we will investigate this to determine the technical root cause of the 5000 threshold limit and keep the article updated in the coming days, so follow this article for future reference.

Demo: Microsoft Power Automate Free plan

Let’s verify which plan we have; in our case, it is Microsoft Power Automate Free.

Microsoft Power Automate Free plan
Microsoft Power Automate Free plan

Next, verify your license.

Click on the gear icon in your Power Automate environment, then click on the “view my licenses” link.

You will see all your licenses assigned to you (as a logged-in user).

Power Automate View my licenses
Power Automate View my licenses

By now, we had seen the plan and license for our account “GD.” Now we’ll see two flows: one that is manually triggered and one that is automated.

Power Automate, which manually triggers flow, has a threshold limit of more than 5000 items.

We have configured the pagination with the 100000 items threshold limit and top count as 5000.

Power Automate manually trigger flow allows more than 5000 items in threshold limit
Power Automate manually trigger flow allows more than 5000 items in threshold limit

Let’s run the flow now.

Power Automate’s manually triggered flow gets more than 5000 items with the threshold configuration.

The Get Items query retrieves all items (7100) from the list.

Power Automate manually trigger flow gets more than 5000 items with the threshold configuration
Power Automate manually trigger flow gets more than 5000 items with the threshold configuration

Verify the total item count in the source list

The above-mentioned list contains a total of 7100 items.

Total item count in source list
Total item count in source list

Power Automate automated trigger flow doesn’t allow you to configure more than 5000 items in the threshold configuration

Now, using the same account (logged in user), if we try to configure the threshold limit in the pagination settings to more than 5000 items and save the flow, we get the following error:

Flow save failed with code 'InvalidPaginationPolicy' and message 'The pagination policy of workflow run action
Flow save failed with code ‘InvalidPaginationPolicy’ and message ‘The pagination policy of workflow run action

Alternative method for retrieving more than 5000 items without using pagination or setting a threshold limit

To get all items without the pagination and threshold limit configuration, use the do-until loop. Please refer to our previous article for the same – Get more than 5000 items using Do Until loop in Power Automate.

Summary: Flow save failed with code ‘InvalidPaginationPolicy’ (Power Automate Get Items Threshold limit)

Thus, in this article, we have learned about how to deal with the Power Automate error “Flow save failed with code ‘InvalidPaginationPolicy’ and message ‘The pagination policy of workflow run action ‘Get_items_2’ of type ‘OpenApiConnection’ at line ‘1’ and column ‘1354’ is not valid. The value specified for property ‘minimumItemsCount’ exceeds the maximum allowed. Actual: ‘100000’. Maximum: ‘5000’.’.”

Other forum where this issue is discussed

See Also: Power Automate Articles Hub (with real-time example)

If you like our articles, please appreciate our efforts by liking and sharing them with your friends and colleagues. Please join the mailing list to get our articles in your inbox as and when we publish them.

Happy automating and learning!

 

About Post Author

Do you have a better solution or question on this topic? Please leave a comment