It's hard to see them in detail in these photos because they are so small. But the 2nd picture looks like there's some nasty stuff in there. Could these be small maggots??
Did you clean the bug cages regularly? I clean mine every few days at least. I have a little system down where I use multiple cages for them because I am a little OCD about things going bad in there and possibly making my chameleon sick. I'd highly suggest keeping the bugs much cleaner. I've learned personally that the bugs need as much care as the chameleon!
Good luck with this. I hope it was just a lapse in not cleaning and it's a one time thing. If you clean everything out, start your bugs all over and it happens again while it's all clean, THEN you have a problem, IMO.