$stateParams problem - Cannot read property of undefined

I have ?catid=123 on a page. But when I access it using $stateParams.catid in the same controller as that page, I get TypeError: Cannot read property 'catid' of undefined

Why is that?

Have you injected $stateParams object?

Yes I do have that…

You do have what? How can we help you unless you share some of your code with us, in this case mentioned controller code.