Update children of a page in a loop ends in error (nesting level too deep)

I need to update the children of a page in a loop, but this ends in an error.

“Nesting level too deep - recursive dependency?”
on the line 928: array_multisort(…$params); in the file kirby/src/Toolkit/Collection.php

foreach($contentpage->children()->listed() as $pg){
		'webprice' => "newprice"

// yml of the parent page

    type: pages
    layout: list 
      - category-item

How are these pages sorted? By date or by number?

They are sorted by number.

Are there any. duplicate numbers maybe?

How many pages are there in the loop?

There are no duplicate numbers. There were 100 items, but when i reduce to 5 items, there still is the error. What could cause this type of error?

Could you send me your project or a stripped down version of it for testing? I can’t reproduce the error in a Starterkit.