Child theme error “Template is missing”

I found the problem.

I went to edit the stylesheet in WordPress’s editor, and saw that the stylesheet’s code had been moved onto 1 line. This meant the top comment section was also on one line, and the Template: twentytwelve was not distinct.

Adding line breaks resolved the problem.