When searching the stats of a token, I get this error: The scope field must be a valid EOS name

You must first translate the symbol into a proper name-encoded value. To do this, take the symbol and turn it into a uint64 value, and then turn that value into a string. Here is a reference for accomplishing this.

An example of the value you should receive when using the symbol EOS is:

name(stringToSymbolCode("EOS")) === ........ehbo5 and the reverse would be symbolCodeToString(nameToUint64("........ehbo5"))

The uint64 of EOS is 5459781