I've found Pandoc error messages to be completely uninformative, since the line number is always wrong. For example, right now I'm working on a file that is 223 lines long, and Pandoc says there's an error on "line 295" (specifically, it says l.295`. Line 295 obviously does not exist. Is there any way I can fix this? Am I just misinterpreting something?
You could be calling some macro within your markdown file that uses a package. The arguments passed to that macro is processed and caused an error within the package code at line 295.
There's no true way to fix this in general, since the code is most likely valid within your document, but not within the package. Moreover, packages can call one another, making for a nested search of lines where mistakes can occur, with calls being valid until they are not. Another example of this is given in why is this error message line number wrong?
The proper solution here would be to understand what arguments are being passed to macros and compare that to what is allowed. Certain arguments may be fragile, for example.