I've written a LOT of code with ChatGPT. Most of it doesn't work. That appears to be on purpose. ChatGPT is happy to explain why to you though. After it writes any code for you always ask "Will this code work?" And see what it says