The code was trying to match the imported scale to an existing scale for the site. It was not loading the items before comparing them, so the matching always failed.