You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug?]: Yarn: 3.6.3 with Playwright CLI fails with EBADF: bad file descriptor, fstat error when used in Yarn PnP environments, preventing CLI-based test execution #7037
Yarn 3.6.3 with Playwright CLI returns an EBADF: bad file descriptor, fstat error in Yarn PnP environments, blocking CLI test runs. Playwright reports it works as expected with Yarn v4.
Is this issue specific to Yarn 3.6.3 versus v4?
ls .yarn/cache/ | grep playwright
### Expected behavior## Expected Behavior
Playwright CLI should work with Yarn PnP environments, allowing test execution via:
```bashyarn playwright test
Actual behavior
Actual Behavior
CLI fails with EBADF error when trying to read test files from Yarn PnP's virtual filesystem:
Error: EBADF: bad file descriptor, fstat
at tryStatSync (node:fs:392:25)
at readFileSync (node:fs:448:17)
at getSourceSync (node:internal/modules/esm/load:66:14)
at getSource (node:internal/modules/esm/translators:65:10)
at createCJSModuleWrap (node:internal/modules/esm/translators:181:32)
at ModuleLoader.commonjsStrategy (node:internal/modules/esm/translators:271:10)
at #translate (node:internal/modules/esm/loader:468:12)
at ModuleLoader.loadAndTranslate (node:internal/modules/esm/loader:515:27)
at async ModuleJob._link (node:internal/modules/esm/module_job:115:19) {
errno: -9,
code: 'EBADF',
syscall: 'fstat'
}
Additional context
Root Cause Analysis
The issue occurs because:
Yarn PnP stores packages in zip archives (.yarn/cache/*.zip)
Playwright CLI uses fs.readFileSync() and fstat to read test files
Virtual file descriptors from zip archives cause fstat to fail with EBADF
The EBADF issue is SOLVED by upgrading to Yarn 3.7.0+ but new error - buffer concatenation problems with image files.
Why: The rimraf cleanup process might be passing incorrect data types to Buffer.concat.
Error:
TypeError: The "list[1]" argument must be an instance of Buffer or Uint8Array.
Received type string ('abc.png')
at Function.concat (node:buffer:602:13)
at node:internal/fs/rimraf:145:32
at .pnp.cjs:19356:13
Trigger: File cleanup operations on PNG files and .last-run.json during test cleanup
Impact: Prevents successful completion of Playwright tests in Yarn PnP environments
But GOOD NEWS, when upgrading to yarn v4.12.0 everything is working
YARN V4 COMPLETELY FIXED THE ISSUES:
✅ No EBADF error - Completely resolved!
✅ No Buffer concatenation error - Completely resolved!
✅ Playwright CLI WORKING - Running tests across all browsers!
Activity
clemyan commentedon Jan 20, 2026
Seems like it was fixed in #5961. Can you upgrade to at least 3.7.0 and try?
sachinnanne commentedon Jan 21, 2026
The EBADF issue is SOLVED by upgrading to Yarn 3.7.0+ but new error - buffer concatenation problems with image files.
Why: The rimraf cleanup process might be passing incorrect data types to Buffer.concat.
Buffer Concatenation Error in Yarn PnP 3.7.0
Trigger: File cleanup operations on PNG files and .last-run.json during test cleanup
Impact: Prevents successful completion of Playwright tests in Yarn PnP environments
But GOOD NEWS, when upgrading to
yarn v4.12.0everything is workingYARN V4 COMPLETELY FIXED THE ISSUES:
✅ No EBADF error - Completely resolved!
✅ No Buffer concatenation error - Completely resolved!
✅ Playwright CLI WORKING - Running tests across all browsers!