The "Execution context was destroyed, most likely because of a navigation" error appears in your Phantom's console when the page it's trying to access closes or reloads before it finishes collecting data. The fix is to reduce the number of pages processed per launch, space out your launches so the website has time to load properly, and check whether a slow proxy or a recent website change is interfering with the run.
Why you’re seeing this
This error appears when the page the Phantom is trying to access closes or reloads before it finishes collecting data. Common reasons include:
- The page crashes or doesn’t load correctly during launch.
- Too many pages open in a row.
- A slow proxy or connection delay interrupts the page load.
- The target website recently changed its layout or code, affecting how your Phantom interacts with it.
How to fix it
Reduce the number of pages per launch
Open your Phantom's Behavior step and lower the number of pages or items processed per launch. Setting it to 10 or fewer is a good starting point when you're seeing this error often.
Space out your launches
Adjust your schedule so launches don't run back-to-back. Giving the target website more time between runs helps pages load properly and reduces navigation interruptions.
Check for recent website changes
If the error keeps happening despite smaller batches and spaced-out launches, it may be caused by a recent change on the target website.
Frequently asked questions
What does "Execution context was destroyed" mean?
It means the page the Phantom was working on closed or reloaded before it finished collecting data. The full error is "Execution context was destroyed, most likely because of a navigation", and it's usually triggered by page crashes, overloaded launches, slow connections, or website changes.
What causes the page to close or reload during a launch?
The most common causes are pages that crash or fail to load properly, too many pages opened in a row, a slow proxy or connection, or a recent change in the target website's layout or code.
Is this error triggered by changes on the target website?
It can be. If the target website recently changed its layout or code, the Phantom may no longer interact with it correctly and pages can close unexpectedly. If you've already reduced inputs and spaced out launches, a website change is the most likely cause.
How many pages should I process per launch to avoid this error?
Start with 10 or fewer pages per launch if you're seeing the error often, then scale up gradually if runs complete without issue.
How is this different from the "Page has crashed" error?
Both errors involve the browser failing mid-run, but "Page has crashed" means the browser tab itself crashed, while "Execution context was destroyed" means the page navigated or reloaded before the Phantom finished working on it. The fixes overlap, but the root causes and recovery behavior are slightly different.
If the error keeps showing up
If you've reduced the number of pages and spaced out your launches but the error continues, get in touch with our Customer Care Team. Please include:
- The Phantom name and a link to the run
- The exact error message from the console
- The target website or URL being processed
- A screenshot of your Behavior step and schedule settings