As dred said, post all of the relevant code that relates to the pokemon you're trying to add.
Since the first error here is due to abilities, you probably don't have that set up correctly. The pokedex refresh code that was provided isn't helping because that isn't what's causing the error.