Open cavities are the interaction structures for a new generation of coherent millimeter, sub-millimeter, and terahertz radiation sources called the gyrotron. One of the open ends of the cavity is intended for rapid extraction of the radiation generated by a powerful electron beam. In the majority of cases, the diffraction loss from this open end dominates over the Ohmic losses on the walls and it results in a low quality factor Q. In earlier studies, an analytical expression of the diffraction Q was derived for weakly irregular waveguide. However, here another expression valid for a more general waveguide is derived. It reduces to previous one in the lowest order expansion of low-order axial mode. And for higher-order axial mode, it gives more precise Q, verified by numerical examples for various transverse modes.