Skip to content

[Bug]: Error when trace is used: apiRequestContext._wrapApiCall: End of central directory record signature not found. Either not a zip file, or file is truncated. (again) #42394

Description

Version

1.62.1

Steps to reproduce

In some cases when the test fails and the trace is recorded (I use on-first-retry), the apiRequestContext._wrapApiCall: End of central directory record signature not found. Either not a zip file, or file is truncated. is being thrown during After Hooks > Fixture "context" step.

I am still trying to find out how to consistently reproduce this problem. For now, what I am noticing is that:

  • it consistently happens on every failed test when running on Jenkins - doesn't matter if I use sharding or not, happens as well with --workers=2 and --workers=1
  • I've seen this error not being throws when only 2 tests within the same test file failed, while all previous cases when it was thrown happened when there were ~3-5 tests failing across 2 different test files.
  • I couldn't reproduce it on my local windows PC

In both cases, the tests are run with PW_TEST_CONNECT_WS_ENDPOINT pointing to a docker machine using mcr.microsoft.com/playwright:v1.62.1-noble.

Expected behavior

Traces should work correctly.

Actual behavior

This error is thrown during After Hooks > Fixture "context" step:
(stacktraces obtained by using PWDEBUGIMPL=1 env var)

apiRequestContext._wrapApiCall: End of central directory record signature not found. Either not a zip file, or file is truncated.
    at captureRawStack (/[...]/node_modules/playwright-core/lib/coreBundle.js:9681:17)
    at captureLibraryStackTrace (/[...]/node_modules/playwright-core/lib/coreBundle.js:56883:17)
    at APIRequestContext2._wrapApiCall (/[...]/node_modules/playwright-core/lib/coreBundle.js:57078:28)
    at ArtifactsRecorder._stopTracing (/[...]/node_modules/playwright/lib/index.js:731:24)
    at ArtifactsRecorder.willCloseRequestContext (/[...]/node_modules/playwright/lib/index.js:673:16)
    at Object.runBeforeCloseRequestContext (/[...]/node_modules/playwright/lib/index.js:165:33)
    at Proxy.<anonymous> (/[...]/node_modules/playwright-core/lib/coreBundle.js:62996:35)
    at APIRequestContext2.dispose (/[...]/node_modules/playwright-core/lib/coreBundle.js:58859:37)
    at _BrowserContext.close (/[...]/node_modules/playwright-core/lib/coreBundle.js:62199:28)
    at close (/[...]/node_modules/playwright/lib/index.js:391:23)
    at Object.context (/[...]/node_modules/playwright/lib/index.js:434:13)
    at /[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:190:9
    at Fixture._teardownInternal (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:229:7)
    at /[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1133:11
    at TimeoutManager.withRunnable (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:403:14)
    at TestInfoImpl._runWithTimeout (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1131:7)
    at TestInfoImpl._runAsStep (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1122:7)
    at Fixture.teardown (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:209:11)
    at FixtureRunner.teardownScope (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:276:9)
    at /[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1667:9
    at TestInfoImpl._runAsStep (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1122:7)
    at WorkerMain._runTest (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1652:5)
    at WorkerMain.runTestGroup (/[...]/node_modules/playwright/lib/worker/workerProcessEntry.js:1510:9)
    at process.<anonymous> (/[...]/node_modules/playwright/lib/common/index.js:1997:25)
<inner error>
Error: End of central directory record signature not found. Either not a zip file, or file is truncated.
    at /[...]/node_modules/playwright-core/lib/utilsBundle.js:38081:18
    at Immediate.<anonymous> (/[...]/node_modules/playwright-core/lib/utilsBundle.js:38599:11)
    at processImmediate (node:internal/timers:485:21)
    at process.callbackTrampoline (node:internal/async_hooks:130:17)

In report it looks like this:

Image

Additional context

I will keep updating this ticket as I keep trying to figure out what the core reason is or what under conditions it fails. Debugging is kinda hard so if you have any ideas on how to gather some more diagnostics or how to pinpoint it better, let me know.

Environment

Remote Jenkins host machine (the one running `npx playwright test`):
  System:
    OS: Linux 6.13 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
    CPU: (64) x64 AMD EPYC 7713P 64-Core Processor
    Memory: 72.82 GB / 125.74 GB
    Container: Yes
  Binaries:
    Node: 22.15.1 - /usr/local/bin/node
    Yarn: 1.22.22 - /usr/local/bin/yarn
    npm: 10.9.2 - /usr/local/bin/npm
  Languages:
    Bash: 5.1.4 - /bin/bash
  npmPackages:
    @playwright/test: 1.62.1 => 1.62.1 

Docker machine with the playwright server (the one running `npx playwright run-server`):
  System:
    OS: Linux 6.13 Ubuntu 24.04.4 LTS 24.04.4 LTS (Noble Numbat)
    CPU: (64) x64 AMD EPYC 7713P 64-Core Processor
    Memory: 75.39 GB / 125.74 GB
    Container: Yes
  Binaries:
    Node: 24.18.1 - /usr/bin/node
    Yarn: 1.22.22 - /usr/bin/yarn
    npm: 11.16.0 - /usr/bin/npm
  Languages:
    Bash: 5.2.21 - /usr/bin/bash

My local machine (where the error does not happen):
  System:
    OS: Windows 11 10.0.26200
    CPU: (14) x64 Intel(R) Core(TM) Ultra 7 265U
    Memory: 7.89 GB / 31.43 GB
  Binaries:
    Node: 22.15.1 - C:\nvm4w\nodejs\node.EXE
    npm: 10.9.2 - C:\nvm4w\nodejs\npm.CMD
  Languages:
    Bash: 5.2.37 - C:\Program Files\Git\usr\bin\bash.EXE
  npmPackages:
    @playwright/test: 1.62.1 => 1.62.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions