diff --git a/src/MailingListManager.php b/src/MailingListManager.php
index 1dba1b3..de4efe0 100644
--- a/src/MailingListManager.php
+++ b/src/MailingListManager.php
@@ -59,6 +59,12 @@ class MailingListManager implements MailingListManagerInterface {
       $this->sessionManager->start();
     }
 
+    if (!$this->sessionManager->isStarted()) {
+      // Unable to start the session, may be called from CLI or no cookies
+      // allowed.
+      return;
+    }
+
     // Add subscription to the session access permissions.
     $collection = $this->userPrivateTempstore->get('mailing_list');
     if (!$grants = $collection->get('grants')) {
