Adding footnote to the table leads to the error: ! Extra }, or forgotten \endgroup

(I'm the author of nicematrix).

This is a partial incompatibility between nicematrix and the columns S of siunitx.

I will try to find a solution but here is a workaround by using the command \tablenum of siunitx (which is the 'command version' of the S column type).

However, the command tablenum seems to delete all the spaces in its argument (and it will delete the spaces in the text of the tabular note). That's why I have put the text of the tabular note in a TeX macro \myfootnote (it would be possible to use \NewDocumentCommand but I wanted to emphasize the fact that it must be protected).

Moreover, the case of an integer number requires a special treatment...

\documentclass{article}
\usepackage{siunitx}
\usepackage{makecell}
\usepackage{nicematrix}
\usepackage{enumitem}

\renewcommand{\theadfont}{\footnotesize\bfseries}
\sisetup{output-decimal-marker={,}}

\NewDocumentCommand { \mytablenum } { } { \tablenum[table-format=3,zero-decimal-to-integer]}

\protected\def\myfootnote{My table note.}

\begin{document}
{\footnotesize
    \begin{NiceTabular}[hvlines,code-before=\rowcolor{gray!50}{1-1}]{
        l
        c
        S[table-format=3.1]
    }
        {\thead{Side-heading\\description}} &
        {\thead{First column\\with data\\description}} &
        {\thead{Second column\\with data\\description}}\\
        Good  & \mytablenum{120,5{\tabularnote{\myfootnote}}} & 41.5\\
        Bad   & \mytablenum{140,}  & 58.5\\
        Total & \mytablenum{60}\rlap{\tabularnote{Another table note.}} & 100.0\\
    \end{NiceTabular}
}

\end{document}

Output of the above code


(I'm the author of nicematrix)

In a first answer to this question, I have said that the problem of the OP is a (partial) incompatibility between nicematrix and the columns S of siunitx. I've given a workaround with \tablenum of siunitx.

Here is another workaround: siunitx is not used at all (in the first column). This is really a heavy workaround because you have to do the job of centering by hand will \hphantom and \rlap. However, by this way, the contents are strictly centered (including the labels of the tabular notes).

\documentclass{article}
\usepackage{siunitx}
\usepackage{makecell}
\usepackage{nicematrix}
\usepackage{enumitem}

\renewcommand{\theadfont}{\footnotesize\bfseries}
\sisetup{output-decimal-marker={,}}


\protected\def\myfootnote{My table note.}

\begin{document}
{\footnotesize
    \begin{NiceTabular}[hvlines,code-before=\rowcolor{gray!50}{1-1}]{
        l
        c
        S[table-format=3.1,zero-decimal-to-integer]
    }
        {\thead{Side-heading\\description}} &
        {\thead{First column\\with data\\description}} &
        {\thead{Second column\\with data\\description}}\\
        Good  & 120,5\hphantom{\textsuperscript{a}} & 41,5\\
        Bad   & 140\rlap{\tabularnote{My first note}}\hphantom{,5\textsuperscript{a}}  & 58,5\\
        Bad   & 140,5\tabularnote{My second note}  & 58,5\\
        Total & \hphantom{0}60\hphantom{,5\textsuperscript{a}} & 100,0\\
    \end{NiceTabular}
}

\end{document}

Output of the above code