I ran into this same error and fixed it by installing the proper Ruby version for OpenStudio 3.4.0, which is 2.7.2 (see