Error in a Quarto document - Missing endcsname inserted. (solved)

I was getting an error and was unable to find the cause. There error when trying to render the qmd was:

compilation failed- missing packages (automatic installed disabled)
Missing endcsname inserted.

textquotesingle
l.339 ... data more cont\textquotesingle{}d-1.pdf}

Cause:
Some of the chunks had apostrophes like this:
#| label: comparisons with count data cont'd

Solution: Remove all apostrophes (of course aka single quotes).