internal error: invalid pattern type (0)