Throw error if improperly defined factory