After migrating legacy SharePoint 2010 Workflows to SharePoint 2019, you may notice the following error when publishing migrated workflows in SharePoint 2019.
"Errors were found when compiling the workflow. The workflow files were saved but cannot be run"
"Unexpected error on server associating the workflow"
Note: Even after being successfully published, Workflow associations may fail to run in SharePoint in case of complex workflows.