<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: 1.35.1</li>
<li>Operating System: Debian Docker</li>
<li>Browser: Chromium</li>
<li>Other info:</li>
</ul>
<h3 dir="auto">Source code</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I provided exact source code that allows reproducing the issue locally.</li>
</ul>
<p dir="auto">I've been running test suites with Playwright in our company for almost a year, and have had no real issues. However, when we tried to onboard one of our larger components to use it, we sometimes get this error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="...
Error: browserContext.addCookies: Browser closed.
==================== Browser output: ====================
&lt;launching&gt; /browsers/chromium-1067/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-06Snae --remote-debugging-pipe --no-startup-window
&lt;launched&gt; pid=178
[pid=178][err] [0712/10[52](https://gitlab.company/-/jobs/1)35.920816:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=178][err] [0712/105236.019824:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=178][err] [0712/105236.020034:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=178][err] [0712/105236.034717:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 198: Permission denied (13)
[pid=178][err] [0712/105236.0352[56](https://gitlab.ballys.tech/dumarca/webfront/-/jobs/6638467#L56):WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[pid=178][err] [0712/105236.083639:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 206: Permission denied (13)
[pid=178][err] [0712/105236.104770:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process.
[pid=178][err] [0712/105236.118682:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
[pid=178] &lt;gracefully close start&gt;
Failed worker ran 1 test:
[project] › tests/search/search.spec.ts:3:5 › Search bar is visible on home page @rdge @plng @se @afun
    at Player.setDismissCookieNotification (/opt/test-root/node_modules/@ci-cd/player/src/pageObjects/player.po.js:47:29)
    at Player.&lt;anonymous&gt; (/opt/test-root/node_modules/@ci-cd/player/src/pageObjects/player.po.js:72:18)
    at fulfilled (/opt/test-root/node_modules/@ci-cd/player/src/pageObjects/player.po.js:5:[58](https://gitlab.company/jobs/1))
··
  3 passed (20.7s)
  1 error was not a part of any test, see above for details
 ..."><pre class="notranslate"><code class="notranslate">...
Error: browserContext.addCookies: Browser closed.
==================== Browser output: ====================
&lt;launching&gt; /browsers/chromium-1067/chrome-linux/chrome --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --user-data-dir=/tmp/playwright_chromiumdev_profile-06Snae --remote-debugging-pipe --no-startup-window
&lt;launched&gt; pid=178
[pid=178][err] [0712/10[52](https://gitlab.company/-/jobs/1)35.920816:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=178][err] [0712/105236.019824:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=178][err] [0712/105236.020034:ERROR:bus.cc(399)] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
[pid=178][err] [0712/105236.034717:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 198: Permission denied (13)
[pid=178][err] [0712/105236.0352[56](https://gitlab.ballys.tech/dumarca/webfront/-/jobs/6638467#L56):WARNING:bluez_dbus_manager.cc(247)] Floss manager not present, cannot set Floss enable/disable.
[pid=178][err] [0712/105236.083639:ERROR:zygote_host_impl_linux.cc(273)] Failed to adjust OOM score of renderer with pid 206: Permission denied (13)
[pid=178][err] [0712/105236.104770:WARNING:sandbox_linux.cc(393)] InitializeSandbox() called with multiple threads in process gpu-process.
[pid=178][err] [0712/105236.118682:ERROR:command_buffer_proxy_impl.cc(128)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
[pid=178] &lt;gracefully close start&gt;
Failed worker ran 1 test:
[project] › tests/search/search.spec.ts:3:5 › Search bar is visible on home page @rdge @plng @se @afun
    at Player.setDismissCookieNotification (/opt/test-root/node_modules/@ci-cd/player/src/pageObjects/player.po.js:47:29)
    at Player.&lt;anonymous&gt; (/opt/test-root/node_modules/@ci-cd/player/src/pageObjects/player.po.js:72:18)
    at fulfilled (/opt/test-root/node_modules/@ci-cd/player/src/pageObjects/player.po.js:5:[58](https://gitlab.company/jobs/1))
··
  3 passed (20.7s)
  1 error was not a part of any test, see above for details
 ...
</code></pre></div>
<p dir="auto">This happens rarely, about one in every thirty runs, and the test themselves are completely empty, only doing a call to an endpoint to make sure we can track the test is run. What might be the cause of this issue? There really isn't anything to share in terms of code, I scaled down to run basically an empty project, and the rest is proven to work, having ran thousands and thousands of suites over a year with no problems. What kind of interaction might cause these problems so I know where to start to look?</p>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">The test runs and passes successfully.</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">The test runs and passes, but the overall suite fails with the above mentioned error.</p>
<h3 dir="auto">System info</h3>
<ul dir="auto">
<li>Playwright Version: [v1.31.2]</li>
<li>Operating System: [Windows 10]</li>
<li>Browser: [Chromium]</li>
<li>Other info:</li>
</ul>
<p dir="auto">I am trying to launch for every test of my repo the same persistent context that I got in my userDir folder.. unfortunately as I have read in other issues, launching a persistent context does force you to reconfigure your test options to make everything work well..<br>
With that said..I am having some issue with saving the videos of every test in my reporter folder. I have a playwright HTML report and an Allure-playwright report. For both of them the video would not showing up, even if I managed to save them in the proper output directory. Below the code of how I set the context:</p>
<h3 dir="auto">Source code</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="        let context: BrowserContext;
        let page: Page;
        signinUrl = baseURL;
        console.log(testInfo.outputDir);
        context = await playwright[browserName].launchPersistentContext('C:/Users/admin/Desktop/TEST_REPO/userDir', {
                baseURL: signinUrl,
                viewport: {
                    &quot;width&quot;: 1366,
                    &quot;height&quot;: 670
                }, recordVideo: {
                    dir: testInfo.outputDir,
                    size: {
                        width: 1280,
                        height: 625
                    }
                },
                locale: &quot;it-IT&quot;,
                proxy: {
                    server: &quot;IP:port&quot;,
                    bypass: &quot;some.domain&quot;
                },
                timezoneId: &quot;Europe/Rome&quot;,
            });
            page = context.pages()[0];
"><pre class="notranslate"><code class="notranslate">        let context: BrowserContext;
        let page: Page;
        signinUrl = baseURL;
        console.log(testInfo.outputDir);
        context = await playwright[browserName].launchPersistentContext('C:/Users/admin/Desktop/TEST_REPO/userDir', {
                baseURL: signinUrl,
                viewport: {
                    "width": 1366,
                    "height": 670
                }, recordVideo: {
                    dir: testInfo.outputDir,
                    size: {
                        width: 1280,
                        height: 625
                    }
                },
                locale: "it-IT",
                proxy: {
                    server: "IP:port",
                    bypass: "some.domain"
                },
                timezoneId: "Europe/Rome",
            });
            page = context.pages()[0];

</code></pre></div>
<p dir="auto"><strong>Config file</strong><br>
This is the config style tha I would normally have without using a persistent context and that indeed works pretty well (video, screenshots, ecc...)</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    {
      name: 'chromium',
&quot;reporter&quot;: [
        [
            &quot;line&quot;
        ],
        [
            &quot;allure-playwright&quot;
        ],
        [
            &quot;html&quot;,
            {
                &quot;outputFolder&quot;: &quot;playwright-report&quot;,
                &quot;open&quot;: &quot;never&quot;
            }
        ]
    ],
      &quot;use&quot;: {
        &quot;locale&quot;: &quot;it-IT&quot;,
        &quot;launchOptions&quot;: {
            &quot;proxy&quot;: {
                &quot;server&quot;: &quot;IP:port&quot;,
                &quot;bypass&quot;: &quot;some.domain&quot;
            }
        },
        &quot;contextOptions&quot;: {
            &quot;locale&quot;: &quot;it-IT&quot;,
            &quot;timezoneId&quot;: &quot;Europe/Rome&quot;
        },
        &quot;viewport&quot;: {
            &quot;width&quot;: 1366,
            &quot;height&quot;: 670
        },
        &quot;screenshot&quot;: &quot;only-on-failure&quot;,
        &quot;video&quot;: {
            &quot;mode&quot;: &quot;on&quot;,
            &quot;size&quot;: {
                &quot;width&quot;: 1280,
                &quot;height&quot;: 625
            }
        },
        &quot;trace&quot;: &quot;retain-on-failure&quot;
    }
    }
});"><pre class="notranslate"><span class="pl-c">// playwright.config.ts</span>
<span class="pl-k">import</span> <span class="pl-kos">{</span> <span class="pl-s1">defineConfig</span><span class="pl-kos">,</span> <span class="pl-s1">devices</span> <span class="pl-kos">}</span> <span class="pl-k">from</span> <span class="pl-s">'@playwright/test'</span><span class="pl-kos">;</span>

<span class="pl-k">export</span> <span class="pl-k">default</span> <span class="pl-en">defineConfig</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">projects</span>: <span class="pl-kos">[</span>
    <span class="pl-kos">{</span>
      <span class="pl-c1">name</span>: <span class="pl-s">'chromium'</span><span class="pl-kos">,</span>
<span class="pl-s">"reporter"</span>: <span class="pl-kos">[</span>
        <span class="pl-kos">[</span>
            <span class="pl-s">"line"</span>
        <span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">[</span>
            <span class="pl-s">"allure-playwright"</span>
        <span class="pl-kos">]</span><span class="pl-kos">,</span>
        <span class="pl-kos">[</span>
            <span class="pl-s">"html"</span><span class="pl-kos">,</span>
            <span class="pl-kos">{</span>
                <span class="pl-s">"outputFolder"</span>: <span class="pl-s">"playwright-report"</span><span class="pl-kos">,</span>
                <span class="pl-s">"open"</span>: <span class="pl-s">"never"</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">]</span>
    <span class="pl-kos">]</span><span class="pl-kos">,</span>
      <span class="pl-s">"use"</span>: <span class="pl-kos">{</span>
        <span class="pl-s">"locale"</span>: <span class="pl-s">"it-IT"</span><span class="pl-kos">,</span>
        <span class="pl-s">"launchOptions"</span>: <span class="pl-kos">{</span>
            <span class="pl-s">"proxy"</span>: <span class="pl-kos">{</span>
                <span class="pl-s">"server"</span>: <span class="pl-s">"IP:port"</span><span class="pl-kos">,</span>
                <span class="pl-s">"bypass"</span>: <span class="pl-s">"some.domain"</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-s">"contextOptions"</span>: <span class="pl-kos">{</span>
            <span class="pl-s">"locale"</span>: <span class="pl-s">"it-IT"</span><span class="pl-kos">,</span>
            <span class="pl-s">"timezoneId"</span>: <span class="pl-s">"Europe/Rome"</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-s">"viewport"</span>: <span class="pl-kos">{</span>
            <span class="pl-s">"width"</span>: <span class="pl-c1">1366</span><span class="pl-kos">,</span>
            <span class="pl-s">"height"</span>: <span class="pl-c1">670</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-s">"screenshot"</span>: <span class="pl-s">"only-on-failure"</span><span class="pl-kos">,</span>
        <span class="pl-s">"video"</span>: <span class="pl-kos">{</span>
            <span class="pl-s">"mode"</span>: <span class="pl-s">"on"</span><span class="pl-kos">,</span>
            <span class="pl-s">"size"</span>: <span class="pl-kos">{</span>
                <span class="pl-s">"width"</span>: <span class="pl-c1">1280</span><span class="pl-kos">,</span>
                <span class="pl-s">"height"</span>: <span class="pl-c1">625</span>
            <span class="pl-kos">}</span>
        <span class="pl-kos">}</span><span class="pl-kos">,</span>
        <span class="pl-s">"trace"</span>: <span class="pl-s">"retain-on-failure"</span>
    <span class="pl-kos">}</span>
    <span class="pl-kos">}</span><span class="pl-kos"></span>
<span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto"><strong>Steps</strong></p>
<ul dir="auto">
<li>Run the test</li>
<li>the test can fail or pass</li>
</ul>
<p dir="auto"><strong>Expected</strong></p>
<p dir="auto">Expect to have my recorded videos inside the HTML and Allure report.</p>
<p dir="auto"><strong>Actual</strong></p>
<p dir="auto">That does not happen.</p>
<p dir="auto">I want also to add that the screenshots insted do appear in my report even if in my persistent context I do not specify anything about while it is specified inside my config.<br>
Also, how can I specify inside my persisten context wheneve I want to record a video? Something like "Only on failure" ecc... thank you.</p>