(#19906) Wrong error from "upgrade" with JSON output when module already installed

Redmine #19906