Description:
When using mergeinstances, if the filenames generated by makeinstances don't match the expected pattern in get_filename, the code fails silently or raises confusing errors. This can happen when users customize the polygon_filename_template but forget to update the corresponding get_filename logic.
Suggestion:
Add a check early in mergeinstances to verify that expected files exist using the configured pattern.
If no file is found or the filename cannot be resolved, raise a clear error with helpful message.
Possibly include a utility function to validate polygon_filename_template and log a warning or fail fast.