Open jennifer-shehane opened 5 years ago
having same problem.... latest cypress and imagesnapshot, why cypress is getting so buggie lol
Any help on how to exactly reproduce this error every time would be appreciated, as I only experienced this once and was not able to reproduce.
It seems the problem only happens when a snapshot is open by an application somewhere else while cypress is trying to clean the directory, so it can't. At least that's seems how I fixed it, by closing the app that still viewing the snapshot images.
Hope it helps
Encountered the same issue on version 3.4.0 on windows 10 OS,
When using npx cypress run
got this error:
Warning: We failed to trash the existing run results.
This error will not alter the exit code.
Error: Command failed: C:\Users\reuve-ga\AppData\Local\Cypress\Cache\3.4.0\Cypress\resources\app\packages\server\node_modules\trash\lib\win-trash.exe C:\cypress\videos\
at ChildProcess.exithandler (child_process.js:287:12)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
This error followed by additional error message at one specific test:
Warning: We failed to record the video.
This error will not alter the exit code.
Error: ffmpeg exited with code 1: C:\cypress\videos\some-test\test-video.mp4: Permission denied
at ChildProcess.<anonymous> (C:\Users\reuve-ga\AppData\Local\Cypress\Cache\3.4.0\Cypress\resources\app\packages\server\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
{ Error: ffmpeg exited with code 1: C:\cypress\videos\some-test\test-video.mp4: Permission denied
at ChildProcess.<anonymous> (C:\Users\reuve-ga\AppData\Local\Cypress\Cache\3.4.0\Cypress\resources\app\packages\server\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
recordingVideoFailed: true }
Error: ffmpeg exited with code 1: C:\cypress\videos\some-test\test-video.mp4: Permission denied
at ChildProcess.<anonymous> (C:\Users\reuve-ga\AppData\Local\Cypress\Cache\3.4.0\Cypress\resources\app\packages\server\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
Reading the permission denied comment in the error message I ran Cypress with admin privileges, This didn't help to resolve the issue. Only then I started looking for the same issue in Cypress github project, found this issue, as @adamchenwei mentioned I found that the video specified in the second warning is open in a media player app.
It looks like Cypress failed to trash the video folder since it was in use by the media player,
So it issued the first warning: Warning: We failed to trash the existing run results.
Then when cypress tried to override the video opened in the media player it got the We failed to record the video
with Permission denied
.
This don`t look like a bug, this is the OS preventing modification of an open file. But Cypress warning message can suggest looking for the specified file in open programs.
thanks @ruvengam . My solution was, delete the video and screenshot files then cypress run again. It works.
+1 for this bug (ran into it also)
Could we shut down this warning with a flag ? --silent
or --quiet
maybe ?
reproduce this issue after update cypress from 3.7.0 to 3.8.0:
jasonzhang@bogon cypress-demo % node run.js
Warning: We failed to trash the existing run results.
This error will not alter the exit code.
Error: Command failed: /Users/jasonzhang/Library/Caches/Cypress/3.8.0/Cypress.app/Contents/Resources/app/packages/server/node_modules/trash/lib/macos-trash /Users/jasonzhang/Documents/code/cypress-demo/cypress/screenshots/sdlg
“sdlg” couldn’t be moved to the trash.
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:203:13)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
When I specify "screenshotsFolder": false
in cypress.json
, this error also occurs.
This issue is on MacOS Catalina as well
@ruvengam Yeah, I'm not able to replicate this while having the previously recorded video or screenshots open in my OS, but there may be something to this idea.
same issue with Windows 10 and Cypress 4.10.0
Warning: We failed to trash the existing run results.
This error will not alter the exit code.
Error: Command failed: C:\Users\user\AppData\Local\Cypress\Cache\4.10.0\Cypress\resources\app\packages\server\node_modules\trash\lib\win-trash.exe C:\dev\cypress\media\tests.ts.mp4
Noticed for some reason the videos and screenshots folders were owned by root (MacOs).
I was able to workaround this by changing the ownership of the folders:
sudo chown -R $(whoami) cypress/videos
sudo chown -R $(whoami) cypress/screenshots
Is this error still occurring? We haven't had reports for some time.
Yes I had this error today running a build in Jenkins on Windows Server 2016. Version 8.3.1 of Cypress
[Pipeline] bat
17:55:29
17:55:29 C:\Users\Agtrader\AppData\Local\Jenkins.jenkins\workspace\Cypress via GitHub>npx cypress --version
17:55:33 Cypress package version: 8.3.1
17:55:33 Cypress binary version: 8.3.1
17:55:33 Electron version: 13.2.0
17:55:33 Bundled Node version:
17:55:33 14.16.0
[Pipeline] bat
17:55:33
17:55:33 C:\Users\Agtrader\AppData\Local\Jenkins.jenkins\workspace\Cypress via GitHub>npx cypress@8.3.1 run --reporter junit --reporter-options mochaFile=result.xml,toConsole=false --spec ".\cypress\integration\cefetra\navigation.spec.js" --browser electron --config video=false
18:00:10
18:00:25 Warning: We failed to trash the existing run results.
18:00:25
18:00:25 This error will not alter the exit code.
18:00:25
18:00:25 Error: Command failed: C:\Users\Agtrader\AppData\Local\Cypress\Cache\8.3.1\Cypress\resources\app\packages\server\node_modules\trash\lib\win-trash.exe C:\Users\Agtrader\AppData\Local\Jenkins.jenkins\workspace\Cypress via GitHub\cypress\screenshots\cefetra
18:00:25
18:00:25 at ChildProcess.exithandler (child_process.js:317:12)
18:00:25 at ChildProcess.emit (events.js:315:20)
18:00:25 at maybeClose (internal/child_process.js:1048:16)
18:00:25 at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) [Pipeline] bat
17:55:29
17:55:29 C:\Users\Agtrader\AppData\Local\Jenkins.jenkins\workspace\Cypress via GitHub>npx cypress --version
17:55:33 Cypress package version: 8.3.1
17:55:33 Cypress binary version: 8.3.1
17:55:33 Electron version: 13.2.0
17:55:33 Bundled Node version:
17:55:33 14.16.0
[Pipeline] bat
17:55:33
17:55:33 C:\Users\Agtrader\AppData\Local\Jenkins.jenkins\workspace\Cypress via GitHub>npx cypress@8.3.1 run --reporter junit --reporter-options mochaFile=result.xml,toConsole=false --spec ".\cypress\integration\cefetra\navigation.spec.js" --browser electron --config video=false
18:00:10
18:00:25 Warning: We failed to trash the existing run results.
18:00:25
18:00:25 This error will not alter the exit code.
18:00:25
18:00:25 Error: Command failed: C:\Users\Agtrader\AppData\Local\Cypress\Cache\8.3.1\Cypress\resources\app\packages\server\node_modules\trash\lib\win-trash.exe C:\Users\Agtrader\AppData\Local\Jenkins.jenkins\workspace\Cypress via GitHub\cypress\screenshots\cefetra
18:00:25
18:00:25 at ChildProcess.exithandler (child_process.js:317:12)
18:00:25 at ChildProcess.emit (events.js:315:20)
18:00:25 at maybeClose (internal/child_process.js:1048:16)
18:00:25 at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
We've been encountering it for about a month here as well. In addition cypress is failing to remove firefox instances. Logging for both issues:
build 13-Sep-2021 16:26:47 > student-case-management-e2e@1.0.0 reportdev E:\bamboo\home\xml-data\build-dir\SFDC-SCME2ED1-JOB1\tests\e2e
build 13-Sep-2021 16:26:47 > npx cypress run --browser firefox --env configFile=dev || cd.
build 13-Sep-2021 16:26:47
build 13-Sep-2021 16:26:56
build 13-Sep-2021 16:27:48 Warning: We failed to trash the existing run results.
build 13-Sep-2021 16:27:48
build 13-Sep-2021 16:27:48 This error will not alter the exit code.
build 13-Sep-2021 16:27:48
build 13-Sep-2021 16:27:48 Error: Command failed: C:\Users\user\AppData\Local\Cypress\Cache\8.3.0\Cypress\resources\app\packages\server\node_modules\trash\lib\win-trash.exe E:\bamboo\home\xml-data\build-dir\SFDC-SCME2ED1-JOB1\tests\e2e\cypress\screenshots\NavLinksAndURLs.spec.ts
build 13-Sep-2021 16:27:48
build 13-Sep-2021 16:27:48 at ChildProcess.exithandler (child_process.js:317:12)
build 13-Sep-2021 16:27:48 at ChildProcess.emit (events.js:315:20)
build 13-Sep-2021 16:27:48 at maybeClose (internal/child_process.js:1048:16)
build 13-Sep-2021 16:27:48 at Socket.<anonymous> (internal/child_process.js:439:11)
build 13-Sep-2021 16:27:48 at Socket.emit (events.js:315:20)
build 13-Sep-2021 16:27:48 at Pipe.<anonymous> (net.js:673:12)
build 13-Sep-2021 16:27:48
build 13-Sep-2021 16:27:51 Warning: We failed to remove old browser profiles from previous runs.
build 13-Sep-2021 16:27:51
build 13-Sep-2021 16:27:51 This error will not alter the exit code.
build 13-Sep-2021 16:27:51
build 13-Sep-2021 16:27:51 Error: EBUSY: resource busy or locked, unlink 'C:\Users\user\AppData\Roaming\Cypress\cy\production\browsers\firefox-stable\run-3304\cookies.sqlite-shm'
There's some suspicion that this error may occur if you are running Cypress processes in parallel on the same machine. One Cypress process may be accessing or writing to the videos folder while the other process is attempting to delete the videos folder.
We do not recommend running multiple Cypress processes in parallel on the same machine. Cypress should be run in parallel machines.
Can anyone confirm if this is or is not how they are running their tests?
Have a single cypress process in my machine but issue still occurs.
I am trying to trigger execution from local machine to cy dashboard., this is a single process as I have closed the test runner. Also, I have closed all preview applications. But the issue occurs
$ npx cypress run --record --key <key> --spec "cypress/integration/specs/ShowMapLayers.feature" --ci-build-id "test1" --group="google-chrome"
The run you are attempting to access is already complete and will not accept new groups.
The existing run is: https://dashboard.cypress.io/projects/<pid>/runs
When a run finishes all of its groups, it waits for a configurable set of time before finally completing. You must add more groups during that time period.
The --tag flag you passed was:
The --group flag you passed was: google-chrome
The --ciBuildId flag you passed was: test1
https://on.cypress.io/already-complete
The existing run is: https://dashboard.cypress.io/projects/projectNum/runs - This has nothing as the trigger did not happen at all.
I'm also having this happen on MacOS. If my videos folder is open, any files with thumbnails currently visible (icons are on and large) causes this error to throw at the beginning of each run for me.
I'm seeing something like this when having screenshotsFolder
, videosFolder
, and the cypress-terminal-report
plugin to the same directory. Perhaps Cypress and the cypress-terminal-report
plugin are both trying to remove the directory?
cypress.json:
{
...
"screenshotsFolder": "./cypress/results",
"videosFolder": "./cypress/results",
...
}
Plugin config:
installLogsPrinter(on, {
// https://github.com/archfz/cypress-terminal-report#options-for-the-plugin-install
includeSuccessfulHookLogs: false,
outputRoot: 'cypress/results/',
outputTarget: {
// format is: '<targetdir>|<extension>': 'txt|json'
// cypress/integration/subdir/filename.test.ts -> cypress/results/<targetdir>/subdir/filename.test.<extension>
'.|log': 'txt',
},
outputVerbose: false,
specRoot: 'cypress/integration',
});
There's some suspicion that this error may occur if you are running Cypress processes in parallel on the same machine. One Cypress process may be accessing or writing to the videos folder while the other process is attempting to delete the videos folder.
We do not recommend running multiple Cypress processes in parallel on the same machine. Cypress should be run in parallel machines.
Can anyone confirm if this is or is not how they are running their tests?
Yes. I am trying to run Cypress in parallel on the same machine and it's doing this exact thing. From what I can gather, the first process tries to delete my screenshots/downloads folder and then the other processes try to do the same but can't find it and log the error.
It's strange though because if I manually start each process in a different CLI I don't get the error. If they are child processes that are created from my script, then the error occurs. It's quite strange and I'm not sure why it doesn't occur when I manually start them.
Um, did we solve this issue or no? :)
Still exist in 9.7.0:
Still exists in 10.9.0
For me this was related to a del
update to 7.0.0 which has a breaking switch to pure ESM. Downgrading to del@6.1.1 fixed it for me on cypress@9.7.0.
Still exists in 11.2.0, is there any updates?
Hello,
Still exists in 12.4.0. So I manage to update macos-trash directly in the cypress.app package.
Download the binary from https://github.com/sindresorhus/macos-trash Extract it and rename from trash to macos-trash
Need to chown (setting the right group) : open a terminal and change to your download directory
chown :staff macos-trash
Browse to the directory (adapt your own path)
cd /Users/xxx/Library/Caches/Cypress/12.4.0/Cypress.app/Contents/Resources/app/node_modules/trash/lib
Keep a copy for the original
cp macos-trash macos-trash-original cp ~/Downloads/macos-trash .
The file was already mark as executable If needed :
chmod +x macos-trash
Now, no more error, the directory is cleaned normally.
Best
John
It happens because the screenshot has nested folders The following commands help me:
PowerShell
give write access to the folder:
icacls "cypress\cypress\screenshots\FOLDER_NAME" /grant:r "$env:USERNAME`:F" /T
Remove the read-only attribute (-R), removes the archive attribute (-A) to the folder
attrib -R -A "cypress\cypress\screenshots\FOLDER_NAME"
change FOLDER_NAME to your folders name
or for multiple nested folders:
Get-ChildItem -Path "cypress\cypress\screenshots" -Directory -Recurse | foreach { attrib -R -A "$($_.FullName)\*" /S }
Get-ChildItem -Path "cypress\cypress\screenshots" -Directory -Recurse | foreach { icacls $_.FullName /grant:r "$env:USERNAME`:F" /T }
Still there ..
Seeing this error as well when running locally on M2 MacBook Pro with Ventura. Using Cypress 12.13.0.
This error will not affect or change the exit code.
Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:413:11)
at spawn (node:child_process:709:9)
at execFile (node:child_process:336:17)
at node:child_process:243:21
at node:electron/js2c/asar_bundle:5:3131
at s.exports (<embedded>:3174:1128678)
at <embedded>:3174:1136681
at <embedded>:3139:423894
at new Promise (<anonymous>)
at r (<embedded>:3139:423875)
at p (<embedded>:3174:1136189)
at <embedded>:4696:491874
at tryCatcher (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
at MappingPromiseArray._promiseFulfilled (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/map.js:61:38)
at MappingPromiseArray.<anonymous> (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise_array.js:114:31)
at MappingPromiseArray.init (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise_array.js:78:10)
at Promise._settlePromise (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:566:21)
at Promise._settlePromise0 (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:694:18)
at Promise._fulfill (/Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:638:18)
at /Users/leadoux/Library/Caches/Cypress/12.13.0/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/nodeback.js:42:21
at <embedded>:1969:98429
at <embedded>:4703:19668
at FSReqCallback.oncomplete (node:fs:188:23)
Hey everyone, I am on Cypress v10.8.0 and i too had the same issue However after updating the "trashAssetsBeforeRuns" to "false" in cypress.config file, I have not seen this issue any more. I guess the downside will be my screenshots and videos folder will now be swamped with evidences until there is a better solution out here
I had this problem and solve it by deleting screenshots and videos folder. Somehow Cypress couldn't delete/clear it automatically by starting the tests. After deleting it manually it works perfect, and folders are generated again.
I am having the exact same problemWarning: We failed to trash the existing run results. I am using the latest Mac os and cypress version.
This error will not affect or change the exit code.
Warning: We failed to trash the existing run results.
This error will not affect or change the exit code.
Error: spawn Unknown system error -86
at ChildProcess.spawn (node:internal/child_process:413:11)
at spawn (node:child_process:783:9)
at execFile (node:child_process:359:17)
at node:child_process:252:21
at node:electron/js2c/asar_bundle:2:3177
at s.exports (
This is a reproducible issue
On Windows 11, if a test fails, then the option trashAssetsBeforeRuns with default true
may fail to delete previous screenshots if there have been previous runs which produced screenshots in nested sub-folders of cypress\screenshots
.
The error message is:
Warning: We failed to trash the existing run results.
This error will not affect or change the exit code.
Cypress: 13.7.1
Continues to be reproducible on Cypress: 13.15.0
Operating system: Windows 11
Node.js: v20.17.0
Using Git Bash shell, execute:
npm install yarn -g
git clone --branch test/trash https://github.com/cypress-io/cypress-realworld-app
cd cypress-realworld-app
yarn
yarn dev
Wait for the "Backend server running" message, then in a separate terminal window, execute
yarn cypress run
cypress\test\demo\show-fail.spec.ts
fails and generates 3 screenshots in the directory
cypress\screenshots\demo\show-fail.spec.ts
Now execute
yarn cypress run --spec cypress/tests/demo/show-fail.spec.ts
Note the error message
Warning: We failed to trash the existing run results.
This error will not affect or change the exit code.
Error: Command failed: C:\Users\mikem\AppData\Local\Cypress\Cache\13.7.1\Cypress\resources\app\node_modules\trash\lib\win-trash.exe C:\Users\mikem\github\cypress-io\cypress-realworld-app\cypress\screenshots\demo
at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:514:28)
at maybeClose (node:internal/child_process:1091:16)
at Process.onexit (node:internal/child_process:302:5)
New screenshots are saved in a different directory
cypress\screenshots\show-fail.spec.ts
Attempt to delete cypress\screenshots
in Windows Explorer.
Note message "Folder Access Denied / You'll need to provide administrator permission to delete this folder". Deletion is not possible.
It is possible to delete directory cypress\screenshots\show-fail.spec.ts
It is not possible to delete directory cypress\screenshots\demo\show-fail.spec.ts
Kill Node.js processes in Windows Task Manager.
Attempt to delete cypress\screenshots
in Windows Explorer.
This is successful.
Note: In case of repeat tests to make sure there is a clean basis (no existing screenshots, no existing servers running), sign out of Windows and back in again, then execute git clean -xfd
before reinstalling with yarn
.
Current behavior:
Running
cypress run
emits an error:Desired behavior:
Not error when trashing folders within
videos
folder.Steps to reproduce:
All I did was
cypress run
on a previous runcypress-example-kitchensink
project. Of course on subsequent runs of ofcypress run
do not produce the same error. 😞Versions
Cypress 3.1.2 Mac High Sierra