Photoshop: Tries to save >4GB .TIFF files

Why does photoshop get to 98% when trying to save a big TIFF file, and then inform you that it can't write the file because of the 4GB file limit for TIFF files? Photoshop knows the size of the document beforehand so it needn't waste your time.

Because the attempts to predict the size of the file were not accurate enough to guess that it would go over 4GB, and the only way to know that it goes over 4GB is to actually write the file and detect that it went over.

No, Photoshop knows the size of the document in memory, but cannot know the exact size of the file until it has written the file. The file on disk includes metadata, format overhead, and compression of your image data. We use a number of heuristics to predict the size of the file ahead of time, and warn you if the estimate goes over the limits for that file format. But heuristics are just informed guesses -- there is no way to exactly know how the image data will compress without actually compressing the image data while writing the file.

The document size in memory has only a loose relation to the file size on disk.
The file on disk has the overhead of the file format, plus metadata, plus compression of the image data (which can actually get larger with some compression choices: like LZW for 16 bit/channel data).