Someone obviously made a mistake. Maybe one of the customs officers forgot they were at work and spoke politely to a traveller or security personal forgot to check inside a pilots hat? Either of those two things would be such a departure from the norm that rescreening would definitely be warranted.