The error line is relative to the intermediate tex file, not the rmd file. Use this post to output to tex and examine with a text editor.
Why the error is being thrown is impossible to guess without a reproducible example. See the FAQ: How to do a minimal reproducible example reprex for beginners.