SharePoint Designer: Errors were found when compiling the workflow

Today I tried to publish a SharePoint Designer Workflow and received the following error:

“Errors were found when compiling the workflow. The workflow files were saved but cannot be run”

The error detail was also not very informative:

“Unexpected error on server associating the workflow”

I found a lot of possible reasons and suggestions how to fix the issue, but nothing worked for me.

How I fixed it

Finally I looked at the workflow settings in one of my lists and found many old workflow instances. After deleting all old and unused instances, the workflows could be published again.

Remove old and unused workflow instances