1. An image forming apparatus comprising: a plurality of image forming units configured to form images, each having a different color; an image bearing member; a detection unit configured to detect a pattern image formed on the image bearing member, the pattern image being used for detecting a color misregistration; a controller configured to control the plurality of image forming units to form on the image bearing member a plurality of first pattern images, each having a different color, and control the detection unit to detect a color misregistration amount related to relative positions between a pattern image having a reference color among the plurality of first pattern images and a pattern image having another color among the plurality of first pattern images; and a storage unit configured to store data on the color misregistration amount, wherein the controller corrects an image forming position of an image of the other color which is to be formed by the plurality of image forming units, based on the data stored in the storage unit, wherein in a case where an error is detected in the data stored in the storage unit, the controller controls the plurality of image forming units to form on the image bearing member a plurality of second pattern images each having a different color before the plurality of first pattern images is formed, and wherein the plurality of second pattern images is different from the plurality of first pattern images.