You are using UPDATE as actionType. This means that, if the database is empty at the moment of starting the script, you will get an error. Probably is better to use APPEND (which creates the context element if it doesn't exist or behaves as UPDATE in the opposite case).