Projects – temporary endeavors to create unique products and services – are both ubiquitous and notoriously difficult to run. Case studies in project management are rife with jobs that ran over time and over budget, some even being canceled with little if any residual value. We study optimal project management in a setting where random setbacks arise naturally during development (e.g., software, construction, or manufacturing). The contractor can shirk, and the sponsor cannot observe the occurrence of setbacks and must rely on unverifiable reports. The optimal dynamic mechanism provides incentives via a cost-plus-award-fee contract featuring a soft deadline or time budget and a terminal payment that is linear in the time remaining on the schedule. Late-stage setbacks require randomization between project cancellation and extension. Because randomization may happen repeatedly, the project can run far beyond its original expected duration and budget and yet be canceled yielding no value. If commitment to randomization probabilities is not possible, the sponsor optimally commits more time and resources to the project, even though it is less valuable to her. Our analysis suggests that although overruns and cancellations are commonly viewed as failures of project governance, such outcomes are necessary features of optimal project management.