Intellij Error: Internal caches are corrupted or have outdated format
Asked Answered
M

8

5

I am getting an error intermittently when I build my Java project in Intellij.

Internal caches are corrupted or have outdated format, forcing project rebuild: java.io.FileNotFoundException: C:\target\classes\ehcache.xml (Access is denied)

I have run File->Invalidate caches. I have restarted Intellij and killed all Java processes. I eventually get it to build again but not sure what thing I try does the trick.

When I try to access the 'Target' folder, it says Access Denied.

Anyone seen this before?

Manganite answered 20/10, 2013 at 17:24 Comment(3)
Can you access the folder from windows explorer and create/remove files? It may have something to do with your user's rights...Geodynamics
No. It says access denied.Manganite
I have this issue even though I have full access rights on all directories involved (it's in my home directory). I get this error even if I run IntelliJ as an administrator! I have also tried the "Invalidate caches" option with full restart, no effect. As soon as I try to compile a class, I get this exact message. The funny thing is that it does not occur if I simply rename the project folder, although nothing concerning rights changed. However, that can't possibly be the solution (especially since we depend on the directory to be named like that).Beauvoir
B
4

As mentioned in my comment, I received the same message, but without any access right issues involved whatsoever.

It seemed to be some kind of confusion on IDEA's end. I was able to fix this by deleting the system directory in C:\Users\%USERNAME%\.IdeaIC13 (the path obviously depends on the IntelliJ IDEA version).

This stores all caches and indices among other things. I have to confess that I can't tell why exactly this helps, but it seems to be a rougher way to "invalidate caches" and it works. Your project history is not deleted this way, so you can practically continue working - just that all files have to be scanned again and all indices have to be rebuilt.

In any event, this was not an access rights problem at all.

Beauvoir answered 13/8, 2014 at 6:8 Comment(1)
For newer versions C:\Users\%USERNAME%\AppData\Local\JetBrains\IntelliJIdea2021.2 But didn't work for me :(Mcvey
A
1

For me, I just had to clean all modules (and ensure they didn't require sudo permission), and rebuild.

The File->Invalidate Caches/Restart... did not work for me.

Appurtenant answered 10/10, 2014 at 22:37 Comment(3)
Didn't work for me neither (just tried to make sure it doesn't work).Jerry
It could be nice to expand the answer to clarify where is the "clean all modules" option in IntelliJ IdeaFamagusta
(in fact the error was "Access is denied")Famagusta
G
0

If you can't access the folder have to either change the rights for the entire hierarchy starting from your project root folder as described here, or move your project to some other directory that you are allowed to access

Geodynamics answered 20/10, 2013 at 18:2 Comment(2)
Tried that but it still says Access Denied.Manganite
You need to recursively grant full access to the directory and all filesGeodynamics
F
0

Tried all the above, but none worked for me. Finally running Intellij 14 in admin mode did the trick.

Fleury answered 26/10, 2015 at 19:32 Comment(2)
Running IntellyJ Idea using a privileged user may "have fixed" your problem, but it's also very probably the cause of your problem. Running as super-user may cause the creation of cache files writable only by a privileged user, and so, as normal user you may have broken features, like the mentioned one. The solution is, check the mentioned files, check their permissions, and fix them assigning these files to the right user, and avoid executing IntelliJ Idea as privileged user again.Famagusta
If permissions really are the issue, then the onus lies on IDEA to fix their error message to report something true rather than something misleading. Either way it's been years and years since I ran into this issue so they probably have fixed it.Fleury
S
0

I had this exact problem, I tried all of the above solutions but none of them worked for me.

The I tried the oldest one in the book (ie rebooting my laptop) and that fixed everything!

Seger answered 11/12, 2018 at 14:23 Comment(0)
E
0

Similar to pdinklag's answer, I had to delete my user-level Android Studio caches to get rid of this error. However, Android Studio caches are stored in ~/.android/.

I shut down Android Studio, then ran:

cd
rm .android/cache build-cache build-cache.lock

Then restarted Android Studio, and things worked.

Eyesight answered 28/10, 2019 at 22:0 Comment(0)
C
0

I had the same problem in Intellij 17 version for Mac. Rebuilding the project, changing the directory of the project, cleaning the module, and running IntelliJ 17 with admin mode did not work.

Updating Intellij to 2019 version solved the error. It seems the application was not able to get the admin permissions.

Crenel answered 25/3, 2020 at 14:36 Comment(2)
IntelliJ 14? Isn't that rather dated? I believe the 2020 version is in beta now.Poliomyelitis
sorry, Intellij 17Crenel
C
0

Nothing worked out for me, not even updating IntelliJ. However I found a solution, in the Project Structure -> Project Settings -> Modules -> Module SDK was set as 1.8 and I changed it to open-jdk21(That was used in all other modules).

Cannonade answered 19/2, 2024 at 19:14 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.