Valid Index but value not found
I have found the answer, The reason for this error is because the data linked to the skin modifier is locked when using edit mode. Simply setting it to object mode unlocked the variables.
Hopefully this helps anyone who was as confused as I was.