socket.gaierror is a subclass of OSError that Python's socket module raises specifically for address-related errors produced by the getaddrinfo() and getnameinfo() functions, which handle translating hostnames/services to socket addresses and vice versa. The exception's accompanying value is a pair (error, string), where error corresponds to one of the EAI_* constants and string is the description returned by the C library's gai_strerror() function. This is documented in the official Python socket module reference.
Community Discussion