Element.SetParameterByName Warning: Internal error, please report: Dereferencing a non-pointer

so how come one works when the other doesnt?

Tip:
Test your scripts on empty files with just the basic ingredients

This appears to be related to the specific node rather than the issue this was created for, which is also quite old (nearly 4 years now).

Please create a new post and include your graph and the Revit file you are using which is creating the issue, as reproducing the error will likely be required to help you troubleshoot the problem.