Which line of code raises this error?
Could you post the complete error message including the stack trace?
Also, please post code snippets by wrapping them into three backticks ```, as it’s easier to debug.