The 'Database' with 'ID' = 'xxxxxxx' doesn't exist in the collection I have a SSAS Tabular server with 30 database.

I also have a scheduled process to backup all databases daily.

When I run the process which is an SSIS package with script task using AMO, I get this error :


  The 'Database' with 'ID' = 'nameofdatabase' doesn't exist in the
  collection.


The backup process is running under the service account credential and it successfully backs up 27 databases but fails for only 3 of them.

I checked those databases and don't see anything special on them.

I googled the error message and most of the issues are related to deploying or processing the database. I don't see any reason for failing the backup.

What is the problem and how I can resolve this issue?
One thing that could cause this is if you use the Name of the database instead of the ID.

For example, I created a database with with the name Demo1, so the ID defaulted to the same string.

Afterwards I renamed the database, but that doesn't change the ID. 

If your AMO script uses the name string instead of the ID string that could cause this error.