We might get this error while trying to access a ReadWrite variable within Script Component outside Post Execute.
Here we were using it within ProcessInputRow method
As per the official documentation – the reason for this error is because ReadWriteVariables are only available inside PostExecute method for improved performance and minimizing locking.