This error message was originated because negative values were being passed to the PWM OCx registers.
The problem seems to be the built in map function.
I'm passing to it unsigned long variables, but it doesn't see them that way. It seems that they are being interpreted has signed shorts because when 32767 is reached, after that the values become negative.
probably you have found a bug in the map function (that is triggered when the values are around the maximum).
may you post an issue on github with an example that fails?