On occasion, a robot will train more than one skill when you ask it to train. Sometimes, when it does this, the robot will end up with negative free XP.
I've found out why. In the file pcaction.pp, the function AutoTraining, the variable FXP is set to the amount of free XP that the robot has. The number of skills that can be trained is counted, and one of these skills is set at random (by picking a random value N, counting down among skills that can be improved until you hit zero).
Then the skill is improved. That is, the skill level is increased by one and the amount of spent XP is reduced by the requisite amount. However, and this is important, the variable FXP is not reduced. N is reset to 5 (I do not see why this should be a fixed, non-random value) and the countdown continues; if N reaches 0 in time to improve another skill, then the cost of the skill is checked against FXP to see if it can be improved. (So if you started with 400XP free, the function can improve two skills at 300XP each, leaving the robot with -200XP. If the robot has enough skills, it can even theoretically improve a third 300XP skill, leaving the robot at -500XP).
I can see two ways to fix this bug; either update FXP when the amount of spent XP changes, or don't reset the value of N to five after training a skill. (Not resetting the value of N to 5 also prevents the system from being more likely to train the later skills on the list, if possible; it does mean that training a robot until it has spent all the experience it can may require the user to tell it to train several times, though, as it will then only autotrain one skill for one level each time).