Sorry to bring an old thread back from the dead, but I just ran into this exact issue!
My newly created viewports were comining up with the number of -1. After doing a zoom extents on the new layout (prior to creating the new viewports), the viewports are numbered properly and I no longer get an error!!
Thanks for figuring this out bikelink!
Access a broad range of knowledge to help get the most out of your products and services.