If there are any errors while using the plugin management tool, it will exit. For docker images, the image won't be able to be created if there's an error. However, if a user is running the tool locally, this could leave the set of plugins in the plugin directory in an inconsistent state, in which not all necessary dependencies for a particular plugin were able to be downloaded. Currently, no newly downloaded plugins are deleted if the tool fails. There are a couple options to clean up the plugin directory in the case of an error.
1) The tool could keep track of if all of a particular plugin's dependencies were downloaded, and if so, keep that plugin and its dependencies in the directory, but delete plugins whose dependencies were not fully downloaded.
2) Another option could be to keep track of the initial state of the plugin directory, and if there are any errors, delete all of the newly downloaded plugins and restore the original directory contents.