Using sorting and paginate together

I have the below frontmatter

title: "stats"
votes: 0
views: 3449
usage: 1788

I need to sort all the recursive pages in multiple sections in the same folder by range. This is what I tried but got an error. execute of template failed at <(.Paginate (sort .RegularPagesRecursive “.Params.usage” “desc”)).Pages>: error calling Pages: runtime error: invalid memory address or nil pointer dereference

{{ range $i, $e := (.Paginate (sort .RegularPagesRecursive ".Params.usage" "desc")).Pages }}

{{ end }} 

I checked the support posts but did not get any answers, any help would be appreciated

In which template does this code appear?

single.html. is this the answer you are expecting ?

Single templates don’t have page collections in context.

ah my bad, doing it in the list.html. apologies

With your code in a list template I am unable to reproduce the problem.

so is the syntax correct ? and we can use sort and paginate together right ? I have 4 nested sections

There’s nothing wrong with the syntax in the proper context, but I have no way of understanding the context without access to a reproducible example.

Yes, like I said, I am unable to reproduce the problem.