playwright: [BUG] Failed worker - Error: ENOENT: no such file or directory ...

System info

  • Playwright Version: v1.34.0
  • Operating System: Ubuntu 22
  • Browser: WebKit
  • Other info:

Source code

I can not provide code, this is only to see if you have a guess what could have happened here. Or to find other playwright users with the same issue.

The CI failed with, while all tests did pass:

  ✓  15 [webkit] › one_of_my_tests.spec.ts:51:7 › One of my tests (15.9s)
Error: ENOENT: no such file or directory, open '/home/vsts/work/1/s/test-results/.playwright-artifacts-2/traces/e69fa91c7a5aeb5562f4-a3b0bd93b675913377a5-3.network'

Failed worker ran 5 tests:
[webkit] › src/tests/....spec.ts:13:7 › Another test
[webkit] › src/tests/....spec.ts:99:7 › Another test
[webkit] › src/tests/....spec.ts:8:5 › Another test
[webkit] › src/tests/one_of_my_tests.spec.ts:14:7 › Another test
[webkit] › src/tests/one_of_my_tests.spec.ts:51:7 › One of my tests

The last statement of the last test did inspect the networking via

const response = await page.waitForResponse(`${process.env.BASE_URL}/deep/link`)
const responseBody = JSON.parse(await response.text())
expect(response.status()).toBe(200)

Could the not found ‘.network’ be a temporary file of inspecting the network? Or could you tell what the ‘.network’ files are good for to narrow down the problem?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 1
  • Comments: 28 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Is there a command to clear this broken cache ?

Couldn’t find a command in the documentation, so I just deleted the folder and it worked.

$ cd /var/folders/yt/x1lbgn513w7cpfxc585w_z500000gn/T
$ rm -rf playwright-transform-cache-501
Error: ENOENT: no such file or directory, open '/var/folders/ln/vb7mq1fj1wq5c10gkggbs61r0000gn/T/playwright-transform-cache-501/59/Amount_59df9d9491b12aca3b5695934d31420e50f20dd6.js'

Something is clearly broken with this cache. I and a colleague locally are experiencing this problem

This is occurring for me as well, only in CI on Jenkins with the same error:

Test passed but then the following error message breaks the test

Error: ENOENT: no such file or directory, open '/home/jenkins/agent/workspace/<project_name>_PR-1/test-results/.playwright-artifacts-0/traces/843f88e1fda41d8e559e-2994db754a0a9a3a89af.trace'

I can see similar errors on our CI (Jenkins) and I cannot reproduce that error on my local machine.

 [12/13] [chromium] › integration/..... Should give me currentUser

[2023-06-06T09:23:54.365Z] [2023-06-06T09:23:54.365Z] Error: ENOENT: no such file or directory, open '/home/pwuser/app/test-results/.playwright-artifacts-0/traces/fa1d6d46b985066ccc8e-3adb4c924fdb19aa9dd8-67.network'

Failed worker ran 6 tests:

The latest statements: 2023-06-06T09:23:56.825Z] [2023-06-06T09:23:56.825Z] 13 passed (4.9m)

[2023-06-06T09:23:56.825Z] [2023-06-06T09:23:56.825Z] 1 error was not a part of any test, see above for details

I am on 1.39 and still get this occasionally - only way around is to manually clear cache

Screenshot 2024-01-16 at 10 45 16

I also noticed that there is an issue with the cache. Removing the cache folder helped. I suspect it could be an issue when npx playwright is used at some places. So I just use yarn playwright instead …

Is there a command to clear this broken cache ?

Not sure if this helps,

I upgraded from 1.32.2 to 1.37.1 and then I got Error: end of central directory record signature not found and Error: ENOENT: no such file or directory, open '/my-test/test-results/.playwright-artifacts-2/8ecfe60c5012dcb08b07f04e2a41444d.zip' only when using --trace=on (everything OK in 1.32.2), and I found that it happened only on a test file not all tests.

So I was looking what’s different between them, I saw that the errors always appear after the steps in beforeAll finish, and found that I had a beforeAll like this:

test.beforeAll(async ({ browser }) => {
  const context = await browser.newContext();
  const page = await context.newPage();
  const page2 = await context.newPage();
  // do something
  context.close();
});

Thus I added await on context.close();:

test.beforeAll(async ({ browser }) => {
  const context = await browser.newContext();
  const page = await context.newPage();
  const page2 = await context.newPage();
  // do something
  await context.close();
});

Then the errors have gone after I added the await !

I have the similar error but in my case Playwright freezes immediately after ENOENT: no such file or directory. The strangest part is that test-results folder doesn’t have anything that looks like .playwright-artifacts-.

Last moments in logs:

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;202;1mpw:channel:response \u001b[0m{ id: \u001b[33m246\u001b[39m } \u001b[38;5;202m+10ms\u0
  pw:channel:response { id: 246 } +10ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;33;1mpw:channel:command \u001b[0m{\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  id: \u001b[33m249\u001b[39m,\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  guid: \u001b[32m'browser-context@bc6bd815c4ba273c5dea28517b1b32b4'\u001b[39m,\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  method: \u001b[32m'close'\u001b[39m,\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  params: \u001b[90mundefined\u001b[39m\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m} \u001b[38;5;33m+10ms\u001b[0
  pw:channel:command {
  pw:channel:command   id: 249,
  pw:channel:command   guid: 'browser-context@bc6bd815c4ba273c5dea28517b1b32b4',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +10ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;34;1mpw:protocol \u001b[0mSEND ► {\"id\":922,\"method\":\"Target.disposeBrowserContext\",\"
  pw:protocol SEND ► {"id":922,"method":"Target.disposeBrowserContext","params":{"browserContextId":"C9EC6A29BC0B60A97AAC2862EFA9280E"}} +16ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;34;1mpw:protocol \u001b[0m◀ RECV {\"id\":922,\"result\":{}} \u001b[38;5;34m+1ms\u001b[0m\n"
  pw:protocol ◀ RECV {"id":922,"result":{}} +1ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;207;1mpw:channel:event \u001b[0m{\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  guid: \u001b[32m'browser-context@bc6bd815c4ba273c5dea28517b1b32b4'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  method: \u001b[32m'close'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@bc6bd815c4ba273c5dea28517b1b32b4',
  pw:channel:event   method: 'close',
  pw:channel:event   params: undefined
  pw:channel:event } +20ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;207;1mpw:channel:event \u001b[0m{\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  guid: \u001b[32m'browser-context@bc6bd815c4ba273c5dea28517b1b32b4'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  method: \u001b[32m'__dispose__'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@bc6bd815c4ba273c5dea28517b1b32b4',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;202;1mpw:channel:response \u001b[0m{ id: \u001b[33m249\u001b[39m } \u001b[38;5;202m+2ms\u00
  pw:channel:response { id: 249 } +2ms

  pw:test teardown _reuseContext +24ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mteardown _setupContextOptions \u001b[38;5;197m+0ms\u001b[0m\n"}}} +0
  pw:test teardown _setupContextOptions +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mteardown _combinedContextOptions \u001b[38;5;197m+0ms\u001b[0m\n"}}}
  pw:test teardown _combinedContextOptions +0ms

  pw:test teardown serviceWorkers +0ms

  pw:test teardown timezoneId +0ms

  pw:test teardown storageState +0ms

  pw:test teardown proxy +0ms

  pw:test teardown permissions +0ms

  pw:test teardown offline +0ms

  pw:test teardown locale +0ms

  pw:test teardown javaScriptEnabled +0ms

  pw:test teardown ignoreHTTPSErrors +0ms

  pw:test teardown httpCredentials +0ms

  pw:test teardown geolocation +0ms

  pw:test teardown extraHTTPHeaders +0ms

  pw:test teardown colorScheme +0ms

  pw:test teardown bypassCSP +0ms

  pw:test teardown acceptDownloads +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mtearing down test scope finished \u001b[38;5;197m+0ms\u001b[0m\n"}}}
  pw:test tearing down test scope finished +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mtearing down worker scope started \u001b[38;5;197m+1ms\u001b[0m\n"}}
  pw:test tearing down worker scope started +1ms

  pw:test teardown browser +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stepBegin","params":{"testId":"85b3cc1667c06e9efc8f-f7dbf111fcd3e82c7dff","stepId":"fixture@fixture: browser@132","parentStepId":"hook@After Hooks@124","title":"fixture: browser","category":"fixture","wallTime":1686852761658}}} +0ms
  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;33;1mpw:channel:command \u001b[0m{\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  id: \u001b[33m250\u001b[39m,\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  guid: \u001b[32m'browser@4675f009ddd92c28a0d84250126c57e6'\u001b[39m,\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  method: \u001b[32m'close'\u001b[39m,\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m  params: \u001b[90mundefined\u001b[39m\n  \u001b[38;5;33;1mpw:channel:command \u001b[0m} \u001b[38;5;33m+2ms\u001b[0m\n"}}} +
  pw:channel:command {
  pw:channel:command   id: 250,
  pw:channel:command   guid: 'browser@4675f009ddd92c28a0d84250126c57e6',
  pw:channel:command   method: 'close',
  pw:channel:command   params: undefined
  pw:channel:command } +2ms

  pw:browser [pid=31653] <gracefully close start> +10s

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;34;1mpw:protocol \u001b[0m◀ RECV {\"id\":-9999,\"result\":{}} \u001b[38;5;34m+1ms\u001b[0m\
  pw:protocol ◀ RECV {"id":-9999,"result":{}} +1ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;207;1mpw:channel:event \u001b[0m{\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  guid: \u001b[32m'browser-context@125a487d62a33efa14d0b92327df5384'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  method: \u001b[32m'close'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@125a487d62a33efa14d0b92327df5384',
  pw:channel:event   method: 'close',
  pw:channel:event   params: undefined
  pw:channel:event } +3ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;207;1mpw:channel:event \u001b[0m{\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  guid: \u001b[32m'browser-context@125a487d62a33efa14d0b92327df5384'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  method: \u001b[32m'__dispose__'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u
  pw:channel:event {
  pw:channel:event   guid: 'browser-context@125a487d62a33efa14d0b92327df5384',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;207;1mpw:channel:event \u001b[0m{\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  guid: \u001b[32m'browser@4675f009ddd92c28a0d84250126c57e6'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  method: \u001b[32m'close'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  param
  pw:channel:event {
  pw:channel:event   guid: 'browser@4675f009ddd92c28a0d84250126c57e6',
  pw:channel:event   method: 'close',
  pw:channel:event   params: undefined
  pw:channel:event } +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;207;1mpw:channel:event \u001b[0m{\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  guid: \u001b[32m'browser@4675f009ddd92c28a0d84250126c57e6'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m  method: \u001b[32m'__dispose__'\u001b[39m,\n  \u001b[38;5;207;1mpw:channel:event \u001b[0m
  pw:channel:event {
  pw:channel:event   guid: 'browser@4675f009ddd92c28a0d84250126c57e6',
  pw:channel:event   method: '__dispose__',
  pw:channel:event   params: {}
  pw:channel:event } +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[30;1mpw:browser \u001b[0m[pid=31653] <process did exit: exitCode=0, signal=null> \u001b[30m+16ms
  pw:browser [pid=31653] <process did exit: exitCode=0, signal=null> +16ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[30;1mpw:browser \u001b[0m[pid=31653] starting temporary directories cleanup \u001b[30m+0ms\u001b
  pw:browser [pid=31653] starting temporary directories cleanup +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[30;1mpw:browser \u001b[0m[pid=31653] finished temporary directories cleanup \u001b[30m+1ms\u001b
  pw:browser [pid=31653] finished temporary directories cleanup +1ms

  pw:browser [pid=31653] <gracefully close end> +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;202;1mpw:channel:response \u001b[0m{ id: \u001b[33m250\u001b[39m } \u001b[38;5;202m+18ms\u0
  pw:channel:response { id: 250 } +18ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stepEnd","params":{"testId":"85b3cc1667c06e9efc8f-f7dbf111fcd3e82c7dff","stepId":"fixture@fixture: browser@132","wallTime":1686852761675}}} +0ms
  pw:test teardown browserName +17ms

  pw:test teardown registerSelectors +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stepBegin","params":{"testId":"85b3cc1667c06e9efc8f-f7dbf111fcd3e82c7dff","stepId":"fixture@fixture: registerSelectors@133","parentStepId":"hook@After Hooks@124","title":"fixture: registerSelectors","category":"fixture","wallTime":1686852761675,"location":{"file":"…/packages/e2e-gherkin/src/test.ts","line":34,"column":6}}}} +0ms
  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stepEnd","params":{"testId":"85b3cc1667c06e9efc8f-f7dbf111fcd3e82c7dff","stepId":"fixture@fixture: registerSelectors@133","wallTime":1686852761675}}} +0ms
  pw:test teardown _setupArtifacts +0ms

  pw:test teardown _browserOptions +115ms

  pw:test teardown _artifactsDir +0ms

  pw:test teardown connectOptions +18ms

  pw:test teardown channel +0ms

  pw:test teardown headless +0ms

  pw:test teardown playwright +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mtearing down worker scope finished \u001b[38;5;197m+0ms\u001b[0m\n"}
  pw:test tearing down worker scope finished +0ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stepEnd","params":{"testId":"85b3cc1667c06e9efc8f-f7dbf111fcd3e82c7dff","stepId":"hook@After Hooks@124","wallTime":1686852761808,"error":{"message":"end of central directory record signature not found","stack":"Error: end of central directory record signature not found\n"}}}} +0ms
  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;202;1mpw:channel:response \u001b[0m{\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m  id: \u001b[33m248\u001b[39m,\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m  error: {\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m    error: {\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m      message: \u001b[32m\"ENOENT: no such file or directory, open '…/e2e/test-results/.playwright-artifacts-7/traces/resources/page@89f61a56ae88316bf09c177cd1e78ed5-1686852757.473029.jpeg'\"\u001b[39m,\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m      stack: \u001b[32m\"Error: ENOENT: no such file or directory, open '…/e2e/test-results/.playwright-artifacts-7/traces/resources/page@89f61a56ae88316bf09c177cd1e78ed5-1686852757.473029.jpeg'\"\u001b[39m,\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m      name: \u001b[32m'Error'\u001b[39m\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m    }\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m  }\n  \u001b[38;5;202;1mpw:channel:response \u001b[0m
  pw:channel:response {
  pw:channel:response   id: 248,
  pw:channel:response   error: {
  pw:channel:response     error: {
  pw:channel:response       message: "ENOENT: no such file or directory, open '…/e2e/test-results/.playwright-artifacts-7/traces/resources/page@89f61a56ae88316bf09c177cd1e78ed5-1686852757.473029.jpeg'",
  pw:channel:response       stack: "Error: ENOENT: no such file or directory, open '…/e2e/test-results/.playwright-artifacts-7/traces/resources/page@89f61a56ae88316bf09c177cd1e78ed5-1686852757.473029.jpeg'",
  pw:channel:response       name: 'Error'
  pw:channel:response     }
  pw:channel:response   }
  pw:channel:response } +134ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stepEnd","params":{"testId":"85b3cc1667c06e9efc8f-f7dbf111fcd3e82c7dff","stepId":"hook@afterEach hook@125","wallTime":1686852761809,"error":{"message":"ENOENT: no such file or directory, open '…/e2e/test-results/.playwright-artifacts-7/traces/resources/page@89f61a56ae88316bf09c177cd1e78ed5-1686852757.473029.jpeg'","stack":"Error: ENOENT: no such file or directory, open '…/e2e/test-results/.playwright-artifacts-7/traces/resources/page@89f61a56ae88316bf09c177cd1e78ed5-1686852757.473029.jpeg'\n    at …/packages/e2e-gherkin/src/runner.ts:545:25\n    at fulfilled (…/packages/e2e-gherkin/build/runner.js:12:24)"}}}} +0ms
  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mtearing down test scope started \u001b[38;5;197m+1ms\u001b[0m\n"}}}
  pw:test tearing down test scope started +1ms

  pw:test:protocol ◀ RECV {"method":"__dispatch__","params":{"method":"stdErr","params":{"text":"  \u001b[38;5;197;1mpw:test \u001b[0mtearing down test scope finished \u001b[38;5;197m+0ms\u001b[0m\n"}}}
  pw:test tearing down test scope finished +0ms

Logs after ctrl+C:

^C  pw:test:task "teardown for start workers" started +0ms
  pw:test:protocol SEND ► {"method":"__stop__"} +0ms
  pw:test:protocol ◀ RECV {"method":"__env_produced__","params":[["TEST_WORKER_INDEX","7"],["TEST_PARALLEL_INDEX","0"]]} +0ms
 ELIFECYCLE  Command failed.

Logs that appears in terminal in few seconds after killing process with ctrl+c:

pw:test:task "teardown for start workers" finished +0ms
  pw:test:task "teardown for report begin" started +0ms
  pw:test:task "test suite" finished +0ms
  pw:test:task "teardown for report begin" finished +0ms
  pw:test:task "teardown for global setup" started +0ms
  1 skipped
  13 passed (5.4m)

UPD1: It looks like it happens only if there is a failed test.

UPD2: only if there is a failed test that fails by throwing uncaught error.