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]: Windows10: shell.trashItem fails with "Failed to create FileOperation instance" #29598
I agree to follow the Code of Conduct that this project adheres to.
I have searched the issue tracker for a feature request that matches the one I want to file, without success.
Electron Version
13.1.1
What operating system are you using?
Windows
Operating System Version
Windows 10 Version 21H1 (OS Build 19043.985)
What arch are you using?
x64
Last Known Working Electron version
12.0.10 Deletes worked on 12.0.10 until I upgraded. Now reverting still produces the issue.
Expected Behavior
shell.trashItem should move the file at the specified path to the recycling bin without failure.
Actual Behavior
shell.trashItem fails in all cases with the error message: Failed to create FileOperation instance. The path to the file is correct and a file exists at the path.
As noted, the exact same code functioned correctly on version 12.0.10. I am unable to complete an upgrade to v13 due to this issue.
Edit: After switching back to electron 12.0.10 on fiddle I am getting the same issue. I'm not sure why.. I am able to delete the file fine through the file explorer. The error message isnt very descriptive either.
I have only tested on Windows 10.
Reacted by Alex, Fabio Spampinato and Mikael Finstad
@zcbenz no it did not work in 11 (had to switch back to shell.moveItemToTrash for 11).
Not sure why it's failing.. is anyone able to try this on an up to date windows machine..? Or at least get it to dump an error log instead the ambiguous failure message.
@nornagon This is not a duplicate of that issue. The error messages are completely different. Change the file path to D:\\DeleteMe\\this.txt in my gist and you still get Uncaught (in promise) Error: Failed to create FileOperation instance. On top of that, my implementation always uses path utilities so the path is never in a non-windows format on windows machines.
Perhaps to bring some clarity to this a more useful error message could be added, ie exactly what went wrong (stacktrace) such that the FileOperation instance could not be created..?
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.
Activity
dscalzi commentedon Jun 12, 2021
Possibly related? #28748
zcbenz commentedon Jun 16, 2021
Do old versions <= 11 work?
dscalzi commentedon Jun 24, 2021
@zcbenz no it did not work in 11 (had to switch back to shell.moveItemToTrash for 11).
Not sure why it's failing.. is anyone able to try this on an up to date windows machine..? Or at least get it to dump an error log instead the ambiguous failure message.
Electron 13.
nornagon commentedon Jul 9, 2021
#28787 is in v13.0.0+ and v12.0.6+ so it doesn't seem likely that that PR is related.
nornagon commentedon Jul 9, 2021
Duplicate of #28831
dscalzi commentedon Jul 10, 2021
@nornagon This is not a duplicate of that issue. The error messages are completely different. Change the file path to
D:\\DeleteMe\\this.txtin my gist and you still getUncaught (in promise) Error: Failed to create FileOperation instance. On top of that, my implementation always usespathutilities so the path is never in a non-windows format on windows machines.Please reopen...
dscalzi commentedon Jul 10, 2021
Perhaps to bring some clarity to this a more useful error message could be added, ie exactly what went wrong (stacktrace) such that the FileOperation instance could not be created..?
lishid commentedon Jul 12, 2021
I can repro as well. Only happens in renderer process. The error message is also
Failed to create FileOperation instance.I'm working around this issue with an IPC to main process instead.
23 remaining items
dscalzi commentedon Jul 3, 2023
AFAIK still an issue
benbowler commentedon Aug 22, 2023
Yes this is still an issue 22nd August
electron-issue-triage commentedon Nov 21, 2023
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
sytolk commentedon Nov 21, 2023
bump
electron-issue-triage commentedon Feb 21, 2024
This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. If you have any new additional information—in particular, if this is still reproducible in the latest version of Electron or in the beta—please include it with your comment!
electron-issue-triage commentedon Mar 23, 2024
This issue has been closed due to inactivity, and will not be monitored. If this is a bug and you can reproduce this issue on a supported version of Electron please open a new issue and include instructions for reproducing the issue.
Electron 13.
Electron 13.
Electron 13.