Chihuahuas have a very sensitive stomach and the wrong food can cause them to throw up.
Yellow foam is a substance Chihuahuas below a year old commonly vomit.
This is the bile in their stomach.
They could be vomiting this substance because of fever, stress, or an upset stomach.