cause I have the same problem in my environment, and I'd like to continue the story .
it seems the problem will definitely occur when start the script.
find an empty directory and start the script .
The problem is due to the reason that the slot used for sending changes to the subscription is created before publication. So, when we decode the changes (in your case 'insert') and check the respective publication, it won't exist by that time. The same problem is being discussed in a slightly different context in the email [1]. As a workaround, if you create a slot after creating a publication, you should not see this error.