I want to get this Feynman diagram:

I have following code, however when I add $$g(b,\overline a)$$ , I get many errors. Could you please tell me how should I get desired result?

\begin{center}
\feynmandiagram[horizontal=a to b]{
i1[particle=$$u(r)$$] -- [anti fermion] a -- [anti fermion] i2[particle=$$u(b)$$],
a -- [gluon, edge label= $$g$$] b,
};
\end{center}
• @campa Awesome, it worked! Thanks a lot. Oct 7 '21 at 16:23
• I was exactly answering this. @somerandomguest also please make your MWE compilable right away (I had to guess that you used tikz-feynman from your other question, I’ve never used that before), the standalone class is quite nice for this. ;) Oct 7 '21 at 16:27

This is due to parsing issue with the comma, you have to use braces {}:

\documentclass{standalone}

\usepackage{tikz-feynman}

\begin{document}

\feynmandiagram[horizontal=a to b]{
i1[particle=$$u(r)$$] -- [anti fermion] a -- [anti fermion] i2[particle=$$u(b)$$],
a -- [gluon, edge label= {$$g,\overline a$$}] b,
};

\end{document}

The output: