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
Cache data is written to userData dir instead of cache dir #8124
Electron version: 1.3.9 (via Atom 1.12.6) and unknown (via Slack 2.3.2)
Operating system: Linux
Expected behavior
Files stored by Electron on behalf of electron apps, should follow the XDG Base Directory specification and place only config files in $XDG_CONFIG_HOME/ (default ~/.config/). cache and data files should be placed in XDG_CACHE_HOME (default: ~/.cache) and XDG_DATA_HOME (default: ~/.local/share) respectively.
As seen in Atom and Slack on Linux, they leave non-config files in ~/.config/Atom and ~/.config/Slack/ in particular, they leave folders such as "databases", "GPUCache", "Cache", "logs", and "Local Storage". Atom mention this as an Electron issue in atom/atom#8281 ("where electron stores it's files").
Could still be it's not Electron's fault that the apps store non-config files in these locations, but hopefully you know more than me here.
Reacted by Valentin Hăloiu, Pau Ruiz Safont, Daniel Aleksandersen, wariw, Jan Tojnar, Bilal Elmoussaoui, Selwyn, Ben Creasy, Jens Gottfried, Bill Kaguru Wanjohi and 221 more
It seams to me though that chromium still uses XDG_CACHE_HOME correctly? Although they do store config and browser history together in XDG_CONFIG_HOME.
Is it possible for Electron to move folders like GPUCache and Cache to XDG_CACHE_HOME, or are those still defined by Chrome/chromium?
Yeah, possibly, I'm not sure why the current behavior was implemented that way so I'd like to understand that. Also changing it means existing apps upgrading will start with a fresh cache right?
Also changing it means existing apps upgrading will start with a fresh cache right?
That doesn't sound dangerous to me, although I'm an outsider here... However to get rid of the old cache, perhaps you could have a move old cache directory on startup if it exists. Then you get to clean up users systems while keeping old cache at the same time, if that's desirable.
I'm okay with moving cache folder, but please do not move user settings folder, this isn't worth breaking every app on the planet. Local Storage / Cookies et al are user data for many apps.
Reacted by baconbrad, Robo, Chris Cowan, Miha Frangež, Tripp Lilley, Matthieu LAURENT and Jaxx Armstrong
If we move the cache folder we will have to add internal logic to clean up the old one. I don't want to update Electron versions and suddenly have two caches (which aren't negligible in size) on the users disk.
I'm okay with moving cache folder, but please do not move user settings folder, this isn't worth breaking every app on the planet. Local Storage / Cookies et al are user data for many apps.
@paulcbetts, I think nobody is suggetting to move user settings... user cache should go to XDG_CACHE_HOME ($HOME/.cache by default)
Ideally, what you refer to as user data (including databases) should go in XDG_DATA_HOME ($HOME/.local/share by default), chrome doesn't In my opinion correctly do this, but many other Linux apps do.
User Settings are already in the correct place (XDG_CONFIG_HOME, defaulting to $HOME/.config).
Is it possible for Electron to simply add a startup hook (that can be removed in 2.0) that moves the old content, and if necessary, adds a symlink in the old location? And does it solve all the concern from e.g. @baconface?
Reacted by Bill Kaguru Wanjohi, Anders, Matthieu LAURENT, Tripp Lilley and Alexey Murz Korepov
Is it possible for Electron to simply add a startup hook (that can be removed in 2.0) that moves the old content, and if necessary, adds a symlink in the old location? And does it solve all the concern from e.g. @baconface?
This will be unpredictable and could cause issues with existing applications. Permission issues, copy speeds and all sorts of other things could cause a working application to suddenly become non-working. This change should be opt-in not automatic IMO.
This bug should honestly be closed as WONTFIX. While OP is probably right, the time to have fixed it is 10+ years ago; it is Too Late now. Leaving this in the hands of developers to deal with would almost certainly be a complete disaster and even trying to auto-migrate everything behind the scenes would almost certainly break applications.
Reacted by sedrubal, Odin Hørthe-Omdal Urdland, Sebastian Danielsson, Atrate, Gabriel A. Devenyi, Diana, Christian Stadelmann, StringEpsilon, Nick Evans, Rhys Perry and 11 more
Why is it too late now? I can't think of a reason why this couldn't be fixed now but could have been fixed in the past. It is still a bug, it is still causing problems for users, and it still has the same route to fixing it as before.
What sorts of disasters are you imagining? What do you believe will go wrong if this is fixed?
At a bare minimum, you could first check the new correct location, and if that is empty check the old incorrect location and do not do any migration. If both are empty, use the new location. If old exists and new doesn't exist, continue using the old path. This would at least allow for manual migration by apps and users, without forcing a migration on anyone.
Reacted by Odin Hørthe-Omdal Urdland, Sebastian Davids, Sebastian Danielsson, wnhrt, Atrate, Max Harmathy, Diana, Christian Stadelmann, Nick Evans, sdupouy and 21 more
Agree with the above. This can very well be fixed now.
We're building a new app on Electron and it'd be very nice to have this correct from the start. I'd also personally fix this for other apps too, since I do remote backup of some of these folders.
Reacted by Atrate, Max Harmathy, Diana, StringEpsilon, Rhys Perry, Gabriel A. Devenyi, Logan Walls, Glib Shpychka, Unai, Coleman McFarland and 3 more
If you don't have anything productive to add (like a PR fixing this issue), please stop it. Ranting doesn't help anyone and won't make it more likely that the devs will fix it.
Reacted by Alberto Fabbri, StringEpsilon, Thomas McWork, Jan Tojnar, Regalia and RunningDroid
Reacted by Gabriel A. Devenyi, Diana, Martin, Unai, Name, 0x5c, Chai, zXNoRegertzzXz, likelyrand and Micheal Pearce
Today (btw issue also became 9 years old) this bug broke my automated backups and while as experienced user I can fix it, it costs time to do so. It also spams my backups with with new useless data on daily basis on programs that I am not aware of they're storing cache in .configs folder or similar. The one single program I realized today doing it caused 750MB (cache) backup trash in few weeks. I may should look what other installed applications are using electron. Such things creates more troubles to inexperienced users which may do not understand what logs are telling. And in additional it creates additional work to other projects, because they are getting annoying bug reports as mine which you can see above, following the link.
People will have to deal with it (programmers and users) until it is fixed. So even if it takes another 12 years to fix it, it is still worth doing so.
Reacted by washeck, Sven Mäder, Robin Daugherty, Max Harmathy, Anton Bulakh, Atrate, Lyle Hanson, Lucas Garron, Nick Evans, Diana and 19 more
Reacted by rugk, Vladislav Shumkin, Felix Stupp, zXNoRegertzzXz and Alex George
This is still a significant issue in Electron apps writing cache data to userData means standard cache cleanup tools miss them entirely. On macOS, this is particularly problematic because Electron apps scatter data across multiple locations:
Quick audit of Electron app cache on macOS:
# Electron apps in Application Support (treating cache as user data)
du -sh ~/Library/Application\ Support/Slack 2>/dev/null
du -sh ~/Library/Application\ Support/discord 2>/dev/null
du -sh ~/Library/Application\ Support/Code 2>/dev/null # VS Code
du -sh ~/Library/Application\ Support/Microsoft\ Teams*2>/dev/null
# Where cache SHOULD be (~/Library/Caches)
du -sh ~/Library/Caches/com.slack.Slack 2>/dev/null
du -sh ~/Library/Caches/com.microsoft.VSCode 2>/dev/null
# GPU shader cache (often overlooked)
du -sh ~/Library/Application\ Support/*/GPUCache 2>/dev/null
du -sh ~/Library/Application\ Support/*/Cache 2>/dev/null
du -sh ~/Library/Application\ Support/*/CachedData 2>/dev/null
On my machine, VS Code alone has ~2GB in Application Support (CachedData, CachedExtensions, User/workspaceStorage). Slack: ~1.5GB. Discord: ~800MB. This data should survive a cache clear but currently it is all mixed together with actual config.
What you can safely clean (Electron apps on macOS):
# These subdirectories within Application Support are cache-like and safe to remove:
rm -rf ~/Library/Application\ Support/*/GPUCache
rm -rf ~/Library/Application\ Support/*/Cache
rm -rf ~/Library/Application\ Support/*/Code\ Cache
rm -rf ~/Library/Application\ Support/*/CachedData
rm -rf ~/Library/Application\ Support/*/Service\ Worker/CacheStorage
For anyone wanting a visual audit of all these scattered caches, I maintain ClearDisk -- a free macOS menu bar app that scans developer caches (including Electron/VS Code cache directories, Docker, Xcode, node_modules, Homebrew, etc.) and shows exactly what is using disk space. Helpful for catching these "hidden" caches that live outside ~/Library/Caches.
Reacted by Daniel Bayley, Lee Williams, 0x5c and zXNoRegertzzXz
Okay, if Electron developers still ignore this critical issue and don't want to fix this, maybe we can start a community-based project with just a script that scans the userData directory and makes symlinks to the XDG_CACHE_HOME directory?
Or maybe there is already something like this exist? If so, would be great to update the issue description with the section "Workarounds", because a lot of comments in this issue got hidden by default by GitHub.
Activity
kevinsawicki commentedon Dec 1, 2016
Chrome provides the paths to these files, it looks like they've labeled this issue as a won't fix in the past.
https://bugs.chromium.org/p/chromium/issues/detail?id=129861
smyrman commentedon Dec 2, 2016
It seams to me though that chromium still uses XDG_CACHE_HOME correctly? Although they do store config and browser history together in XDG_CONFIG_HOME.
Is it possible for Electron to move folders like GPUCache and Cache to XDG_CACHE_HOME, or are those still defined by Chrome/chromium?
kevinsawicki commentedon Dec 2, 2016
Those files are completely managed by Chrome I believe, are you seeing standalone Chrome store them in a different location?
smyrman commentedon Dec 2, 2016
I find ~/.cache/google-chrome/Default/
Cache 'Media Cache'
and:
~/.config/google-chrome/Default/GPUCache
, so actually, it just seams inconsistent...
Thanks for the quick reply!
deepak1556 commentedon Dec 2, 2016
Yup its possible. Currently we set the cache path to app data path in brightray. @kevinsawicki are we ok on changing this ?
kevinsawicki commentedon Dec 2, 2016
Yeah, possibly, I'm not sure why the current behavior was implemented that way so I'd like to understand that. Also changing it means existing apps upgrading will start with a fresh cache right?
smyrman commentedon Dec 2, 2016
That doesn't sound dangerous to me, although I'm an outsider here... However to get rid of the old cache, perhaps you could have a move old cache directory on startup if it exists. Then you get to clean up users systems while keeping old cache at the same time, if that's desirable.
deepak1556 commentedon Dec 3, 2016
Yup.
Maybe we can adopt this with next chromium update release or 2.0 ?
anaisbetts commentedon Dec 3, 2016
I'm okay with moving cache folder, but please do not move user settings folder, this isn't worth breaking every app on the planet. Local Storage / Cookies et al are user data for many apps.
MarshallOfSound commentedon Dec 3, 2016
If we move the cache folder we will have to add internal logic to clean up the old one. I don't want to update Electron versions and suddenly have two caches (which aren't negligible in size) on the users disk.
smyrman commentedon Dec 5, 2016
@paulcbetts, I think nobody is suggetting to move user settings... user cache should go to XDG_CACHE_HOME ($HOME/.cache by default)
Ideally, what you refer to as user data (including databases) should go in XDG_DATA_HOME ($HOME/.local/share by default), chrome doesn't In my opinion correctly do this, but many other Linux apps do.
User Settings are already in the correct place (XDG_CONFIG_HOME, defaulting to $HOME/.config).
Is it possible for Electron to simply add a startup hook (that can be removed in 2.0) that moves the old content, and if necessary, adds a symlink in the old location? And does it solve all the concern from e.g. @baconface?
MarshallOfSound commentedon Dec 5, 2016
This will be unpredictable and could cause issues with existing applications. Permission issues, copy speeds and all sorts of other things could cause a working application to suddenly become non-working. This change should be opt-in not automatic IMO.
122 remaining items
anaisbetts commentedon Aug 10, 2025
This bug should honestly be closed as WONTFIX. While OP is probably right, the time to have fixed it is 10+ years ago; it is Too Late now. Leaving this in the hands of developers to deal with would almost certainly be a complete disaster and even trying to auto-migrate everything behind the scenes would almost certainly break applications.
MicahZoltu commentedon Aug 10, 2025
Why is it too late now? I can't think of a reason why this couldn't be fixed now but could have been fixed in the past. It is still a bug, it is still causing problems for users, and it still has the same route to fixing it as before.
What sorts of disasters are you imagining? What do you believe will go wrong if this is fixed?
At a bare minimum, you could first check the new correct location, and if that is empty check the old incorrect location and do not do any migration. If both are empty, use the new location. If old exists and new doesn't exist, continue using the old path. This would at least allow for manual migration by apps and users, without forcing a migration on anyone.
odinho commentedon Aug 10, 2025
Agree with the above. This can very well be fixed now.
We're building a new app on Electron and it'd be very nice to have this correct from the start. I'd also personally fix this for other apps too, since I do remote backup of some of these folders.
severindupouy commentedon Aug 10, 2025
bump
heroin-moose commentedon Aug 11, 2025
At this point Electron is beyond repair. Just use Qt guys. It’s hopeless.
likelyrand commentedon Nov 10, 2025
almost 9 years and still not fixed, what a joke
genodeftest commentedon Nov 10, 2025
If you don't have anything productive to add (like a PR fixing this issue), please stop it. Ranting doesn't help anyone and won't make it more likely that the devs will fix it.
heroin-moose commentedon Nov 12, 2025
Everything productive already here. Multiple people suggested backward-compatible algorithm.
Half-and-Xat commentedon Dec 1, 2025
Mozilla fixed their issue after 21 years, just a few days ago. So why electron shouldn't be able to implement this? It is just a matter of willingness.
Today (btw issue also became 9 years old) this bug broke my automated backups and while as experienced user I can fix it, it costs time to do so. It also spams my backups with with new useless data on daily basis on programs that I am not aware of they're storing cache in
.configsfolder or similar. The one single program I realized today doing it caused 750MB (cache) backup trash in few weeks. I may should look what other installed applications are using electron. Such things creates more troubles to inexperienced users which may do not understand what logs are telling. And in additional it creates additional work to other projects, because they are getting annoying bug reports as mine which you can see above, following the link.People will have to deal with it (programmers and users) until it is fixed. So even if it takes another 12 years to fix it, it is still worth doing so.
bysiber commentedon Mar 2, 2026
This is still a significant issue in Electron apps writing cache data to
userDatameans standard cache cleanup tools miss them entirely. On macOS, this is particularly problematic because Electron apps scatter data across multiple locations:Quick audit of Electron app cache on macOS:
On my machine, VS Code alone has ~2GB in Application Support (CachedData, CachedExtensions, User/workspaceStorage). Slack: ~1.5GB. Discord: ~800MB. This data should survive a cache clear but currently it is all mixed together with actual config.
What you can safely clean (Electron apps on macOS):
For anyone wanting a visual audit of all these scattered caches, I maintain ClearDisk -- a free macOS menu bar app that scans developer caches (including Electron/VS Code cache directories, Docker, Xcode, node_modules, Homebrew, etc.) and shows exactly what is using disk space. Helpful for catching these "hidden" caches that live outside
~/Library/Caches.regalialong commentedon Mar 2, 2026
Hey, you might wanna check the synchrony of your clocks (i mean both your system and internal one).
MurzNN commentedon Jul 17, 2026
Okay, if Electron developers still ignore this critical issue and don't want to fix this, maybe we can start a community-based project with just a script that scans the
userDatadirectory and makes symlinks to theXDG_CACHE_HOMEdirectory?Or maybe there is already something like this exist? If so, would be great to update the issue description with the section "Workarounds", because a lot of comments in this issue got hidden by default by GitHub.
shvchk commentedon Jul 29, 2026
@MurzNN I've been using danisztls/ephemeral for a year or two without issues