I'm not sure. I haven't really used type_masks so I cannot say for sure, but here are some things I would try:
| Putting Rigidbody.new() in your array of objects to exclude
| Putting Rigidbody in the array
| Putting typeof(Rigidbody) in the array
| Putting RigidBody.new().get_rid() in the array
| Putting the actual Rigidbody(s) in the array.
Hopefully one of those will work. I think you can just use Rigidbody's RID and that will mask out all Rigidbodies, but I'm not sure. Let me know if none of those work and I'll see what I can do.
Depending on your use case, you may just be able to place the objects you want to mask on a different collision layer. Then you can raycast with it checking for collision bodies only in the select collision layers. I would recommend using a raycast node if you want to go down that route as I've found its easier than trying to do it in GDScript.