Apparently irrational biases such as overconfidence, optimism, and pessimism are increasingly studied by biologists, psychologists, and neuroscientists. Functional explanations of such phenomena are essential; we argue that recent proposals, focused on benefits from overestimating the probability of success in conflicts or practising self-deception to better deceive others, are still lacking in crucial regards. Attention must be paid to the difference between cognitive and outcome biases; outcome biases are suboptimal, yet cognitive biases can be optimal. However, given that cognitive biases are subjectively experienced by affected individuals, developing theory and collecting evidence on them poses challenges. An evolutionary theory of cognitive bias might require closer integration of function and mechanism, analysing the evolution of constraints imposed by the mechanisms that determine behaviour.