Depends on what’s happening.
In most cases sparks are bad.
But sometimes they are part of the process.
Most UPSs will spark when a battery is connected. This is with the UPS off.
Big inverters will have a huge and possibly damaging spark when connected. So a resistor should be used to bring the system up. Then connect the battery, then power it on.
All the Best,
Jeff