Cannot read property 'trim' of null in autocomplete popup

I’m trying to implement autocomplete popup on click of a button.But when I click on the button it gives me cannot read property ‘trim’ of undefined error in the console.Can anyone please help me .

You need to specify pageTitle parameter for autocomplete