The language production system continually learns. The system adapts to recent experiences while also reflecting the experience accumulated over the lifetime. This article presents a theory that explains how speakers implicitly learn novel phonotactic patterns as they produce syllables. The learning is revealed in their speech errors. For example, if speakers produce syllable strings in which the consonant /f/ is always a syllable onset, their slips will obey this rule; /f/'s will then slip mostly to onset positions. The article reviews over 30 phenomena related to this finding. To explain phonotactic learning, the article presents four linked "mini-theories," each of which addresses components of the data. The first mini-theory, the production theory, provides an account of how speech errors arise during the assembly of word forms. The second, the learning theory, characterizes the implicit learning of phoneme distributions within the production system. The third mini-theory, the consolidation theory, augments the learning theory to explain instances in which this learning depends on a period of time, possibly a sleep period, before it is expressed. The final mini-theory, the developmental theory, addresses cases in which learning varies between children and adults, and depends on speakers' early linguistic experience. The resulting theory forges links between these diverse aspects of psychology.