Ok I've done even more testing and this is getting very strange.
I setup a new blog and I copied all the themes and plugins over from the old blog to the new one.
I then created a new custom post type and couldn't reproduce the error.
Now I really don't understand as the error can't be caused by plugins or themes.