Upon tracing the error in EE 2.7.2, I found it to be caused by LL. 4265–4267 in system/expressionengine/controllers/cp/design.php:
if (strlen($template) > 50)
{
continue;
}
If the template name is longer than 50 characters (including an extension like ".html"), the next line does not set $file_date
:
$file_date = get_file_info($basepath.'/'.$group.'/'.$template);
This leads to the error being generated in system/expressionengine/views/design/sync_confirm.php:
$file_edit = ($template['file_exists'] === FALSE) ? lang('no_file_exists') : $template['file_edit'];
I am not sure why the 50 character arbitrary limit exists in design.php, but it seems to me that limit should be enforced at the points a user sets the template name in the first place. I filed a bug report on this issue, so perhaps EllisLab will enlighten me on the purpose of this code.
Further, I don't see anything in the documentation regarding template name length. All it says is:
Template Name
Template names may only contain alpha-numberic characters and no
spaces. Since template names are typically used as part of a URL they
must follow the standard URL naming rules.
So for now, the solution is to limit template names to less than 50 characters. Longer names seem to cause no issues aside from the error on the sync screen, but I haven't traced all the code to verify errors don't occur elsewhere.