Error message buffer overflow.

BigusDickus:
I guess what I'm really looking for is a function that will tell me how long the string created by sprintf_P() will be before I actually use it !

Yes, that seems to be what you're looking for. Happily, snprintf_P() and friends does exactly what you need.