Complications and technical failures of endoscopic retrograde cholangiopancreatography (ERCP) cause significant morbidity and, occasionally, mortality. An understanding of patient- and procedure-related risks is important for decision making with regard to whether or how ERCP should be performed. Instances in which ERCP is the least clearly indicated are often the most likely to cause complications. Patient-related risk factors include suspected sphincter of Oddi (SO) dysfunction, female sex, normal serum bilirubin, or previous history of post-ERCP pancreatitis, with multiple risk factors conferring especially high risk. Technique-related risk factors include difficult cannulation, pancreatic contrast injection, balloon sphincter dilation, and precut sphincterotomy performed by endoscopists of varied experience. Pancreatic stents may reduce the risk of pancreatitis in a number of settings including SO dysfunction. Hemorrhage and perforation are rare and can be avoided with endoscopic technique and attention to the patient's coagulation status. Cholangitis is avoidable with adequate biliary drainage. Because success rates are higher and complication rates lower for endoscopists performing large volumes of ERCP, ERCP should be concentrated as much as possible among endoscopists with adequate experience. Patients with a high risk for complications may be best served by referral to an advanced center.