I can change desktop background successfully in Script Editor with the following code.
tell application "Finder" to set desktop picture to POSIX file "/path/3Q83dROp3Fk.jpg"
But the following code in terminal doesn't work
osascript -e "tell application \"Finder\" to set desktop picture to POSIX file \"/path/3Q83dROp3Fk.jpg\""
Save the script file as 1.scpt
and run the osascript 1.scpt
returns 1.scpt: execution error: Finder got an error: AppleEvent handler failed. (-10000)
System: macOS High Sierra.