We can't tell what is causing the error without testing your code. You can open a support ticket and send us your AppBuilder project, so we can test it locally.
Alternatively, you can debug your app yourself to check the values of the variables you use:
Debug in the Simulator
Debugging on Device