How to Solve Cookie Expiration Errors

This guide explains why session cookies expire and provides clear steps to prevent and fix cookie expiration errors that can stop your PhantomBuster automations.

What is a session cookie error

When a session cookie becomes invalid, your Phantom will display an "Expired session cookie" or "Invalid session cookie" error message.

This prevents PhantomBuster from accessing your account and running your automations.

Several factors can cause your session cookie to expire or become invalid. Let's walk through them below.

Why do session cookies expire or become invalid

Here’s what can cause your session cookie to expire or become invalid:

1. Logged out or session expiration errors

  • Manually logging out of your account ends the session and invalidates the cookie.

  • You may also be logged out automatically after a period of inactivity.

To prevent this: Stay logged into your social media accounts while your Phantoms are running.

2. Exceeding platform rate limits

Social networks like LinkedIn, Facebook, and Instagram monitor user activity. If your behavior seems unnatural (e.g., too many actions too fast), they might:

  • Trigger warnings or temporary blocks

  • Invalidate your session cookie as a protective measure

Common reasons for this on LinkedIn include:

  • Using automation tools

  • Too many pending connection requests

  • Being marked as “I don’t know this person”

  • Violating LinkedIn’s terms or profile rules

To prevent this:

  • Build up your activity gradually to mimic natural human behavior.

  • Adjust Behavior settings in your Phantoms to avoid spikes.

  • Stay within recommended daily action limits.

For example:

Sending 5 connection requests one day and 500 the next on LinkedIn is highly suspicious and could lead to warnings or account restrictions.

→ For a detailed guide, check out our blog post: LinkedIn Account Restricted? Here's How to Fix It.

Untitled.jpeg

3. Multiple login locations or devices

Social platforms flag suspicious activity when your account is accessed from different:

  • Devices

  • IP addresses

  • Geographic locations

Social media platforms expect your account to be used in one place at a time.
If it looks like someone is logging in from two places at once, they might flag it as suspicious and end your session.

For example:

If you're manually logged into Facebook from France, but your Phantom is running from a U.S. proxy, the platform may think your account is being accessed by someone else, and expire your session cookie.

To prevent this:

  • Use a consistent device and IP when automating.

  • Set up a proxy if you need to run automations from other regions.

  • Regularly refresh your session by logging in manually.

This helps maintain a stable session and prevents unexpected cookie expiration during automation.

4. Server-side session cookie expiration

Some platforms expire sessions after a set time, regardless of your activity.

To prevent this:

Log into your account periodically to keep the session alive.

5. Missing or outdated browser user agent

If you're using PhantomBuster with tools like Zapier, Make, n8n, Clay, or Postman, you may need to manually provide both:

PhantomBuster captures this info automatically when you use our browser extension. But third-party tools don't, and without both, the platform you're connecting to might reject the session as suspicious.

To prevent this:

  • Always use the same browser and device where you collected the session cookie.

  • Make sure your browser is up to date.

  • If asked, include your browser’s user agent.

How to Fix "Expired Session Cookie" or "Invalid Session Cookie" Errors

If your Phantom shows a session cookie error during execution:

Example of an "Expired session cookie" error displayed in a Phantom's console.

phantom-console-expired-session-cookie-error.jpeg

Follow these steps to refresh your session:

1. Go to your PhantomBuster Dashboard

2. Find the Phantom that triggered the error.
➔ It will display a warning icon where your platform identity usually appears, along with an error tag.

dashboard-session-cookies-warning-error.jpeg

3. Click on the error displayed on the Phantom card.
➔ This will open the Phantom's console, where you can view the error message.

4. Click the Resolve button inside the console.

phantom-console-invalid-session-cookie-resolve.jpeg

5. You will be redirected to the Phantom’s Setup page.
➔ Click the Connect now button to reconnect to the platform.

phantom-set-up-connect-now.jpeg

6. The browser extension will automatically detect your new session.
➔ Click Save to confirm the new connection.

Your session cookie has been refreshed and your Phantom can now run normally.

How to avoid future session Cookie errors

To reduce the risk of session cookie expiration or invalidation:

  • Stay logged into your platform accounts while running PhantomBuster automations.

  • Gradually scale your activity to stay within platform-imposed limits.

  • Use consistent devices and IP addresses, or set up proxies when needed.

  • Regularly refresh your session by logging into your account.

  • If using external tools, include your browser’s user agent.

Was this article helpful?

0 out of 3 found this helpful