The upgrade script uses File::Path::rmtree() to remove WebGUI's temp files and cache. The way rmtree() is being called makes it remove the files _and_ the root directory for the cache, e.g. if one has set fileCacheRoot to /var/cache/webgui, the upgrade script will remove /var/cache/webgui contents _and_ /var/cache/webgui afterwards, leaving the installation without a valid fileCacheRoot.
This can be fixed with
File::Path::rmtree($path,{ keep_root => 1 })
so the root of the operation ($path) is not removed.