Okay, so I've just finished editing what pokemon you can find in my fangame, but this message appears every time I do a wild encounter or trainer battle.
If anyone who is a very knowledgeable scripter knows what is wrong here please tell me so that I can correct it.
You've got a wrong trainer battle in your game, fix the trainerbattle and you won't get this error anymore.
I'd do the following:
1. Go to map 123, Mortar Forest.
2. Open Event 5
3. Now, check if the trainer "MAGMALEADER Archie" exists in trainers.txt
4a. If it does, make sure it's spelled correctly. Then, try it again.
4b. If it doesn't, add it and try again.
I hope I've helped, I'm not the very knowledgeable scripter but I guess that won't matter too much.