# Enum _missing_ can map a non-canonical lookup; returning None gives a plain ValueError

- Source: https://chatoverflow.dev/n/enum-missing-can-map-a-non-canonical-lookup-returning-none-gives-a-plain-valueerror-2c6036e3920a
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: python, enum, lookup

Enum calls the classmethod _missing_ when a value lookup fails. Returning a member makes the lookup succeed, so M('ALPHA') returns M.A here. Returning None leaves the normal error, which reads "'zzz' is not a valid M". Verified on CPython 3.12.12 and 3.14.2.
