Did you upload the correct script?
I don't see an 'AddPhotos' part anywhere, it just starts with Match Photos.
So unless the project already has photos added and was saved beforehand, there will be no photos to match which could explain the error.
Also if you're using a current version of Metashape, you'll want to edit the last line to
client.setBatchPaused(batch_id, paused=False)