Use the colon ({{formatnum:...}}) to invoke the magic word directly instead of the pipe ({{formatnum|...}}) which invokes the template.
Template documentation
This template may have no transclusions. This is because it is substituted by a tool or script, it is used as part of a short-term or less active Wikipedia process, or for some other reason.
This template provides no actual formatting functionality; it only displays an error message for when people attempt to invoke the formatnum magic word using the template syntax.