You need to share more of your code.
Without context I assume it is impossible to analyze what the cause is.