Illigal Variable-length quantity format in exported MIDI

Some times when exporting midi files, by playing them back from timidity I get the message

take2.mid: Illigal Variable-length quantity format.

Although timidity plays such files without problem, in analysing them from other sources (e.g. Python) the tracks can’t be handled because they are “corrupted” as my program reports.

Does any one know what Illigal Variable-length quantity format means and how should I avoid it?

Many thanks
Amir

Probably best would be to post a MIDI file which generates that error so someone else can try to analyze where the problem exists in the file. The error message is too vague to guess which quantity is noted as incorrect.