Building by ants often involves excavation, but Temnothorax albipennis colonies build walls in preformed cavities. To do this they need to choose and retrieve building material. Thus, building in T. albipennis can be analysed, in part, from the perspective of a foraging strategy. We gave ant colonies a choice between large and small sand grains that were available at three different distances. From theoretical considerations, we expected ant colonies to maximize the amount of material collected per unit time and therefore to choose large grains exclusively. Instead, they always chose grains of both sizes. Such partial preferences can be explained in terms of the mechanical benefits of constructing walls as a mixture of two grain sizes. Barricades composed of two grain sizes can be more resilient than walls made from a single grain size, as estimated in terms of angles of maximum stability and packing densities. Thus, foraging decisions need to be analysed in the broader context of how collected material is utilized. Here partial foraging preferences can have direct benefits: different choices by different foragers and even individual ‘error’ proneness might contribute to the collective good.