what would you do when you are stuck?
the first word will say "Whyyyyyyy?" when seeing an error or something unexpected as you want maybe will say other words.
try to know what is your problem and discover location of error.
try to debug your code then find what you are missing.
try to split your code as you can.
in most cases, error can be helpful for knowing why is error happend
try to copy and paste it in StackOverflow most of time will be found some answer.
Check your spelling
Google it
Read the error
Break down the problem
Don’t panic