Did you set LD_LIBRARY_PATH?
There are a couple other things that may need to be set in the environment too.
There are some combination of options that the CLI Scanner doesn’t like or operations that need to be done in multiple steps.
If at all feasible, let me encourage you to use the HTTP API or the Python PlexAPI instead. 