What is the plural of "detective sergeant"?
Solution 1:
The origin of the noun detective, as in a policeman who 'detects' crimes, is the adjective:
1828, short for detective police, from detective (adj.) "fitted for or skilled in detecting" (by 1828); — Etymonline
It follows that, in detective sergeant, the word should also really be an adjective. That means the head of the noun group is sergeant, and detective is a simple attribute. Only the head should be pluralised, so it should be detective sergeants.
The script writers may have been confused by words like Knight Templar, in which the first word can be read as the noun and the second the adjective, in which case it should be Knights Templar.