Throwing error in cases like #3357 and returning NULL