TikZ, forest and star macro

I cannot answer the question about the usage starred macros in forest keys, but it is generally not recommended to use macros that expand to pgf keys. Rather, this is what styles are for. And with styles there is no problem, and the code becomes even shorter.

\documentclass[12pt,a4paper]{article}
\usepackage{forest}
\forestset{el/.style={edge label={node[midway, fill=white]{#1}}},
el*/.style={}}
\begin{document}

\begin{forest}
[
    [$A$, el={$a$}
        [$B$, el={$b$}]
        [$C$, el={$c$}]
    ]
    [$D$, el*={$d$}
        [$E$, el*={$e$}]
        [$F$, el*={$f$}]
    ]
]
\end{forest}

\end{document}

enter image description here

ADDENDUM: As mentioned by @cfr, it may be safer not to use a star. So maybe

\documentclass[12pt,a4paper]{article}
\usepackage{forest}
\forestset{el/.style={edge label={node[midway, fill=white]{#1}}},
el!/.style={}}
\begin{document}

\begin{forest}
[
    [$A$, el={$a$}
        [$B$, el={$b$}]
        [$C$, el={$c$}]
    ]
    [$D$, el!={$d$}
        [$E$, el!={$e$}]
        [$F$, el!={$f$}]
    ]
]
\end{forest}

\end{document}

is a safer choice. Who knows.


I'd go with a style, as suggested in the other answer.

The problem seems to lie in expandability, as the following working code shows.

\documentclass[12pt,a4paper]{article}

\usepackage{forest,xparse}

\NewExpandableDocumentCommand{\probaweight}{sm}{%
  \IfBooleanTF{#1}%
    {}%
    {node[midway, fill=white]{#2}}%
}

\begin{document}

\begin{forest}
[
    [$A$, edge label=\probaweight{$a$}
        [$B$, edge label=\probaweight{$b$}]
        [$C$, edge label=\probaweight{$c$}]
    ]
    [$D$, edge label=\probaweight*{$d$}
        [$E$, edge label=\probaweight*{$e$}]
        [$F$, edge label=\probaweight*{$f$}]
    ]
]
\end{forest}

\end{document}

enter image description here