Wa `alaykum as-salamu wa rahmatullahi wa barakatuh.
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
1- Islam endorses all good foods and forbids anything that is considered harmful, filthy or even distasteful to sound nature.
2- There is no specific text, either from the Qur’an or the Sunnah stating anything concerning caterpillars. Hence, it depends on the harm or benefit it may contain and, also, on the eater nature whether he/she accepts such a kind of food or not.
In his response to your question, Sheikh Ahmad Kutty, a senior lecturer and an Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
As far as I know, there is nothing in the sources either forbidding caterpillar or endorsing it. However, Islam does not allow us to eat anything that is considered harmful, filthy or even distasteful to sound nature. Allah says, “He permits for you all that is pure and wholesome, and prohibits all that is filthy (and harmful).” (Al-A`raf 7:157)
I don’t know whether consuming caterpillars is good for health or not. However, I would not like to eat them. Mind you, there is no shortage of good things, we are allowed to consume. So, why go for that which is doubtful?
Allah Almighty knows best.