Simple. Overstaying or/and expired passport will lead to that. Valid status is not a fixed binary state. It is better described as a function of personal id, rights docs and current time. Currently, the checks are more akin to updating a Boolean column on rare occasions. Digital id countries do checks more like function calls that you can perform easily and quickly