sys.exit if any errors in getting image id