Some hosts of the brown-headed cowbird (Molothrus ater) possess defences that eliminate all or most parasitism costs. Yellow warblers (Dendroica petechia) bury cowbird eggs, possibly to clean nests rather than serving strictly as an anti-parasite defence, as non-egg-shaped objects have been ejected, buried, or deserted by other hosts. With two experiments, we tested the ‘nest sanitation’ hypothesis by recording warblers’ responses to objects (1) similar in volume, mass, and colour to cowbird eggs, and (2) half the mass and volume (more easily ejected), placed into nests before and during incubation. We compared outcomes at control nests with responses to objects that were dissimilar (stars) and moderately similar (dumbbells) to eggs, and to real cowbird and warbler eggs. We tested whether rejection (1) declines from stars through dumbbells and real eggs, (2) is similar between stages, and (3) non-egg-shaped objects are ejected because this is the least costly rejection method. Large stars were rejected (most buried) significantly more frequently (43.8%) than cowbird eggs (16.3%) in pre-incubation, suggesting that warblers reject objects shaped unlike their own eggs to rid nests of debris. Objects spent less time in nests the more they diverged from eggs. Warblers rarely rejected large stars and dumbbells, and cowbird eggs during incubation, possibly because burial and desertion are too costly by this time. Responses to small stars and dumbbells, and to foreign yellow warbler eggs did not differ between stages; also warblers rejected stars, mostly by ejection and selective burial, more frequently (28.8%) than dumbbells (1.3%) and warbler eggs (0%). Rejection by yellow warblers, especially burial, may keep nests clean, but also functions in rejecting cowbird eggs.