To reproduce, run the following command:
/replaceitem entity @p armor.chest cod
The expected error message is something like "[Raw Cod] cannot be applied to this slot," or even "Unable to replace the item." The actual error message is "The target does not have the specified slot."
Well, the correct error message was shown in 18w06a, I'll try the other versions...