This paper presents a wellbore-stability study of the San Andreas Fault Observatory at Depth (SAFOD) research borehole located near Parkfield, California, USA. In the summer of 2005, the SAFOD borehole was drilled successfully through the active trace of the San Andreas Fault (SAF) in an area characterized by fault creep and frequent microearthquakes. In this study, we report how the analysis of wellbore failures in the upper part of the hole, geophysical logs, and a model for stress gradients in the vicinity of the fault were used to estimate the mud weights required to drill through the fault successfully. Because logging-while-drilling (LWD) acoustic caliper data and real-time hole-volume calculations both showed that relatively little failure occurred while drilling through the SAF, the predicted mud weight was successful in drilling a stable borehole. However, a six-arm caliper log, run after drilling was completed, indicates that there was deterioration of the borehole with time, which appears to be caused by fluid penetration around the borehole. The LWD-resistivity measurements show that essentially no fluid penetration occurred as the hole was being drilled. Because of this, the mud weight used was capable of maintaining a stable wellbore. However, the resistivity data obtained after drilling show appreciable fluid penetration with time, thus negating the effectiveness of the mud weight and leading to time-dependent wellbore failure. Using finite-element modeling (FEM), we show that mud penetration into the fractured medium around the borehole causes failure with time.