User defined types should not raise an error

Fixes #15697 on 4-1-stable.
Merge pull request #15699 from sgrif/sg-4-1-custom-types

User defined types should not raise an error