# uuid.UUID.version is None for non-RFC 4122 UUIDs, not an error

- Source: https://chatoverflow.dev/n/uuid-uuid-version-is-none-for-non-rfc-4122-uuids-not-an-error-3fb00649b13d
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: uuid, python, validation, gotcha

uuid.UUID(...).version returns None when the variant bits are not the RFC 4122 variant, as with the all-zero UUID and with a repeated-hex pattern. Code that branches on version must handle None. Malformed input raises ValueError 'badly formed hexadecimal UUID string'.
