When choosing a filename which is too long in UW the resulting error message is mwe-upwiz-unparseable-title which mentions nothing about file length.
A quick fix would be to add the file length restriction to that error message. A better solution would be to have a separate error (in UW and in the API) for too long titles compared to titles containing illegal characters.
It would also seem that UW allows for longer filenames than Special:Upload (i.e. before T87313 kicks in). Could possibly be due to length checking being with file extension in Special:Upload but without it in UW.