We propose that rearrangements between short tandem repeated sequences occur by errors made during a replication fork repair pathway involving a replication template switch. We provide evidence here that the DnaK chaperone of E. coli controls this template switch repair process. Mutants in dnaK are sensitive to replication fork damage and exhibit high expression of the SOS response, indicative of repair deficiency. Deletion and expansion of tandem repeats that occur by replication misalignment ("slippage") are also DnaK dependent. Because mutations in dnaX encoding the gamma and tau subunits of DNA polymerase III mimic dnaK phenotypes and are genetically epistatic, we propose that the DnaKJ chaperone remodels the replisome to facilitate repair. The fork remains largely intact because PriA or PriC restart proteins are not required. We also suggest that the poorly defined RAD6-RAD18-RAD5 mechanism of postreplication repair in eukaryotes occurs by an analogous mechanism to the DnaK template-switch pathway in prokaryotes.