One of the hallmarks of human cognition is cognitive flexibility, the ability to adapt thoughts and behaviors according to changing task demands. Previous research has suggested that the number of different exemplars that must be processed within a task (the set size) can influence an individual's ability to switch flexibly between different tasks. This paper provides evidence that when tasks have a small set size, children's cognitive flexibility is impaired compared to when tasks have a large set size. This paper also offers insights into the mechanism by which this effect comes about. Understanding how set size interacts with task-switching informs the debate regarding the relative contributions of bottom-up priming and top-down control processes in the development of cognitive flexibility. We tested two accounts for the relationship between set size and cognitive flexibility: the (bottom-up) Stimulus-Task Priming account and the (top-down) Rule Representation account. Our findings offered support for the Stimulus-Task Priming account, but not for the Rule Representation account. They suggest that children are susceptible to bottom-up priming caused by stimulus repetition, and that this priming can impair their ability to switch between tasks. These findings make important theoretical and practical contributions to the executive function literature: theoretically, they show that the basic features of a task exert a significant influence on children's ability to flexibly shift between tasks through bottom-up priming effects. Practically, they suggest that children's cognitive flexibility may have been underestimated relative to adults', as paradigms used with children typically have a smaller set size than those used with adults. These findings also have applications in education, where they have the potential to inform teaching in key areas where cognitive flexibility is required, such as mathematics and literacy.