I had the same problem recently. My error message was:  terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 140) > this->size() (which is 130)