Hi,
This is a bug, my PR is pending merge into master
https://github.com/frappe/frappe/pull/5171
If it’s urgent please comment lines 17 and 18 in,
frappe/frappe/custom/doctype/custom_field/custom_field.py
Or
Use the code change in PR
And run bench migrate