Can't add instance of custom field type to entity
You’re confusing the required length property of a varchar field with the size property of a text field.

Replace size with length (or varchar with text if that makes more sense) and your code should start working.