I recently reinstalled LaTeX and I'm encountering this error. It happens on nearly every compilation step and I don't know how to fix it.
When compiling, if a PDF is produced, the beginning of the PDF displays about a page and a half of XMP data which is supposed to be metadata.
This error shows up in total about 20 times each on my attempts to compile both .tex files from this repository: https://github.com/liantze/AltaCV
/usr/local/texlive/2021/texmf-dist/tex/latex/pdfx/pdfx.sty:2855: LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.2855 \includexmp{\xmp@template}
%
This is on MacOS 11.4. TeXLive 2021. Installed with the unix installer from https://www.tug.org/mactex/mactex-unix-download.html.

\begin{document}. Try to compile a minimal document. – Bernard Jul 19 '21 at 19:51pdflatex-devsee https://tex.stackexchange.com/questions/605854/error-using-pdfx-on-tex-live-2021#comment1519200_605854 – David Carlisle Jul 21 '21 at 11:29\RequirePackage[a-1b]{pdfx}solves this error. When loading pdfx, even the minimal example of\documentclass{altacv} \begin{document} Hello \end{document}produces the error on the 2021 distribution as of August 5, 2021. – jan Aug 06 '21 at 04:34pdfxorxmpinclpackages. So, LaTeX certainly can write the metadata. As noted, the problem probably lies withpdfx. I recall that, a couple of years ago, some TeXlive yearly update had a bad interaction withpdfx. But I do not recall the details, or whether it has since been resolved. Did not affect my own code. – rallg Apr 14 '23 at 17:26