glCompressedTexImage2D generates GL_INVALID_ENUM

glCompressedTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT, 2048, 2048, 0, 4194304, 0) generates GL_INVALID_ENUM on nVidia 8800 and works properly on AMD 3850.
Same call but with GL_TEXTURE_2D works properly on nVidia too.
Why is this happening?

don’t know why it works properly in AMD but you tell OpenGL that pixeldata you specify is in compressed format. In order to do it correctly you also need to calculate correct image size taking blocksize into account. If you want to convert to DXT from uncompressed data on the fly use glTexImage2D with specified DXT format.
Size of your DXT5 texture:
dxt5size = ((width + 3) / 4) * ((height + 3) / 4) * 16; // 16 blocksize of DXT5

other then that see the documentation why the function could possibly return INVALID_ENUM.
GL_PROXY_TEXTURE_2D is not reliable after all. was a good idea but not to be trusted.

Yes, pixeldata is compressed.
Yes, data size is calculated taking blocksize into account.
What’s wrong with this? I don’t understand.

might be a driver bug. try installing latest drivers and see if it’s still reproduceable to be sure.