In two experiments, the effects of an introduction of deviant trials on precue-based and memory-based task switching were investigated. Deviant trials were trials that deviated from task foreknowledge as induced either by precues or memory of the task sequence. The experiments differed with respect to the number of tasks to be switched among (two in Experiment 1, four in Experiment 2). In Experiment 1, the introduction of deviant trials had a detrimental effect on precue-based task preparation, but had little impact on memory-based preparation. The latter observation was due to the fact that there was little evidence for memory-based preparation at the outset. In Experiment 2, introducing deviant trials had little effect on either precue-based or memory-based preparation. In contrast to Experiment 1, in Experiment 2 memory-based preparation was as effective as precue-based preparation.