Ok, the error seems to be coming from template::form::render. There's a line that says:
foreach button $form_properties(${form_properties(mode)}_buttons) {
so I guess my mode is "view". I thought mode could either be "display" or "edit" - are there other possible values mode can take?