WordPress emails error regarding the argument type even if the type is correct

Firstly, this isn’t a WordPress error. It’s a PHP error. WordPress is not going to return type errors. That all happens and the language level. If you used the same values outside of WordPress you’d get the same error.

Regarding your specific issue, keep in mind that get_terms() will return a WP_Error object if the taxonomy is invalid or if your code is run before the taxonomy is registered. That’s most likely what’s happening here.