As for the number of arguments, it's my fault because I modified this macro for another file and forgot to modify it again for the problematic file. I almost always use it in text mode.
I also have a problem with another macro that I haven't modified, but no works since my update.

##########################################################################################
\protected\def\card#1{\m{\mfunction{Card}\thinspace#1}}

##########################################################################################
tex error       > tex error on line 366 in file ./chapter-5.tex: Missing { inserted

<to be read again>
   
    \endgroup
<macro> \math_m_nop
    #1->\relax \ifmmode #1\else \normalstartimath \usemathstyleparameter \mathematicsparameter \c!mathstyle \expand \everyinsidemathematics \relax \begingroup #1\endgroup
    \normalstopimath \fi
<macro> \vector
    #1->\starttikzpicture [thick,baseline=(arg.base),>=stealth] \node [inner xsep=0pt] (arg) {\m {#1}
    }; \draw [->,shorten >=-1pt ] (arg.north west) -- (arg.north east); \stoptikzpicture
<argument>
    \vector {_}
    \cdot \vector {k=1}
<macro> \math_m_nop
    #1->\relax \ifmmode #1
    \else \normalstartimath \usemathstyleparameter \mathematicsparameter \c!mathstyle \expand \everyinsidemathematics \relax \begingroup #1\endgroup \normalstopimath \fi
<argument>
    \mfunction {Card}\thinspace \prod _{k=1}
    ^{n}A_k
 ...

<line 3.366>
                \card{\prod_{k=1}^{n}A_k}
    =\prod_{k=1}^{n}\card{A_k}.

356                 \card{A\times B}=\card{A}\times \card{B}.
357               \stopformula
358             \stopproposition
359             \startproposition
360               {Cas général} Soient un entier \m{n\geqslant 2} et  \m{A_1, A_2, \dots, A_n}, \m{n} ensembles finis. Nous disposons de l'égalité
361               \startformula
362                 \card{A_1\times A_2\times \cdots \times A_n}=\card{A_1}\times \card{A_2}\times \cdots \times \card{A_n},
363               \stopformula
364               soit
365               \startformula
366 >>              \card{\prod_{k=1}^{n}A_k}=\prod_{k=1}^{n}\card{A_k}.
367               \stopformula
368             \stopproposition
369             \startRemark
370               Le principe multiplicatif peut être énoncé de la façon suivante :
371    
372               si une situation aléatoire comporte \m{n} choix, chaque choix ayant respectivement \m{a_1, a_2, \dots , a_n} possibilités, alors le nombre d'issues possibles est
373               \startformula
374                 a_1\times a_2\times \cdots \times a_n.
375               \stopformula
376             \stopRemark
A left brace was mandatory here, so I've put one in.
mtx-context     | fatal error: return code: 1

TeX Output exited abnormally with code 1 at Sat Mar 15 15:55:01

Le sam. 15 mars 2025 à 14:04, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> a écrit :
Am 15.03.2025 um 13:52 schrieb Fabrice Couvreur:
> Hi,
> That's true, it's better with a little bit of code. But the file is
> large and I didn't know what to show.
>
> ##################################################################################################
> \protected\def\coord#1#2#3{\math{#1\left(#2\,;#3\right)}}

You create your command with 3 argument but pass only 2 arguments and
whatever follows it as third argument.

Do you even use it in text mode or can \math be removed from the definition?

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________