Based on the error message you provided, it seems that there might be an issue with the script that you're using.
To troubleshoot this issue, I would recommend checking the script for any syntax errors or missing values. You mentioned that some of the code has a "null" next to it, which could be causing the problem. Make sure that all data fields have a valid entry and that there are no empty values.
We’d suggest you go to Office Development - Microsoft Q&A to create a new thread which is special channel for handle script issue.
Here is the Community for Power Automate.
Microsoft Power Automate Community - Power Platform Community