Dual citizen issue with EU e-gates
Dual EU/US citizen here. I recently flew into Barcelona and went to the EU citizen line (as I have regularly done), which had the option to wait for one of two border officers (there was a short line) or use the e-gates (no line). I had never used the e-gates before and figured it would be quicker. When I went to put my passport on, it took a long time, and ultimately rejected it. They told me it was because when I left the US, I used my US passport, and I needed to use the same passport for the whole journey. So then they sent me to the ESS line, which was obviously longer.
This all sounded wrong to me, so I kept holding my EU passport up where it could be seen, and someone eventually noticed and told me I should go back to the EU entry, which I did. This time, I went to the short line to show a border officer. She took my passport, scanned it, and gave it back to me. No issues.
Any idea what I did wrong? Since things seem to be moving more digital, I'd like to avoid any future issues. For what it's worth, my passports have slightly different spellings of my name.