When running a groovy script for a specific Foglight agent, the script fails because there is a special character such as a parenthesis (parentheses).
For example
spiAgentName = "SPIRepository-ABCD00001234.example.com (ABCD00001234_FGLAM01)";
The presence of parentheses in the agent name interferes with the findByName(...) method. This method will try to parse the name as a Regular Expression (Regex) where parentheses are special characters.
RESOLUTION 1
Use a Regular Expression wild card character such as
spiAgentName = "SPIRepository-ABCD00001234.example.com.";
RESOLUTION 2
Adjust the groovy script to use the AgentID instead of the agent name.