>>56063636I'm just drawing conclusions because I don't know what the battle function looks like off the top of my head, but that makes the most sense to me. When you start a fresh game and never obtain a Pokemon, battles will never initiate. You'll get a fade out and it will end instantly. It's probably doing the same here(checking if you have any valid Pokemon), and giving you a loss because you have a valid slot(where the Porygon used to be), but no Pokemon with enough HP to battle.
Normally you'd never be able to have 0HP on the overworld without whiting out, but you didn't encounter any checks for that until being spotted by the trainer.
I'll have to look more into encountering trainers during wild battles. Can you reproduce that while entering normally?