PyCharm - Unable to save settings - Failed to save settings. Please restart PyCharm Community Edition
Asked Answered
G

14

16

PyCharm is trowing this exception when I save.

WARN - mponents.impl.stores.StoreUtil - Save settings failed
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    at java.lang.String.charAt(String.java:658)
    at com.intellij.configurationStore.ApplicationStorageManager.expandMacros(ApplicationStoreImpl.kt:108)
    at com.intellij.configurationStore.StateStorageManagerImpl.createStateStorage(StateStorageManagerImpl.kt:194)
    at com.intellij.configurationStore.StateStorageManagerImpl.getOrCreateStorage(StateStorageManagerImpl.kt:150)
    at com.intellij.configurationStore.StateStorageManagerImpl.getStateStorage(StateStorageManagerImpl.kt:133)
    at com.intellij.configurationStore.StateStorageManagerImpl$startExternalization$1.setState(StateStorageManagerImpl.kt:342)
    at com.intellij.configurationStore.ComponentStoreImpl.commitComponent(ComponentStoreImpl.kt:199)
    at com.intellij.configurationStore.ComponentStoreImpl.save(ComponentStoreImpl.kt:124)
    at com.intellij.openapi.components.impl.stores.StoreUtil.save(StoreUtil.java:49)
    at com.intellij.openapi.application.impl.ApplicationImpl.saveSettings(ApplicationImpl.java:1433)
    at com.intellij.ide.SaveAndSyncHandlerImpl.doSaveDocumentsAndProjectsAndApp(SaveAndSyncHandlerImpl.java:150)
    at com.intellij.ide.SaveAndSyncHandlerImpl.saveProjectsAndDocuments(SaveAndSyncHandlerImpl.java:134)
    at com.intellij.ide.SaveAndSyncHandlerImpl$4.onFrameDeactivated(SaveAndSyncHandlerImpl.java:104)
    at com.intellij.ide.FrameStateManagerImpl.fireDeactivationEvent(FrameStateManagerImpl.java:87)
    at com.intellij.ide.FrameStateManagerImpl.access$500(FrameStateManagerImpl.java:32)
    at com.intellij.ide.FrameStateManagerImpl$2$1.run(FrameStateManagerImpl.java:72)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.runNextEvent(LaterInvocator.java:337)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:321)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:726)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:866)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:654)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:381)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

And giving me this error message.

enter image description here

I don't think it's a problem of permissions on the .idea file or anything like that, but I'm really not sure.

I get some other errors and warnings in the stack trace, but this is the one that recurs when I try to save projects.

This problem persists when I run PyCharm CE with sudo like this sudo -u [username] /Applications/PyCharm\ CE.app/Contents/MacOS/pycharm

Anyone got any ideas?

OS: MacOS El Capitan Pycharm: PyCharm Community Edition 5.0.5 JRE: 1.8.0_76-release-b162 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.

Gisborne answered 29/5, 2016 at 15:19 Comment(3)
I have the same problem. Somehow I found that the error disappears when I delete the .idea directory. But after a while of using it again, the error comes back.Langer
Could it be a permissions problem on the .idea directory?Gisborne
I get this same error with WebStorm. (stack trace has the java.lang.StringIndexOutOfBoundsException: String index out of range: 0 -- changing permissions on .idea dir doesn't help me.Ringside
A
5

Make sure you are running 'Pycharm.exe' as Administrator.

'Run As Administrator' for all Users solves this problem in Windows OS.

Attenuate answered 1/12, 2016 at 10:42 Comment(0)
O
3

In my case, this was indeed permissions on the .idea directory; it was owned by Administrator, and I wasn't running as Administrator. I changed the owner of .idea via Windows Explorer and things were okay again.

So, what happened to break it? I normally run as non-Administrator, because IT has Administrator half-locked down on our PCs. If you run PyCharm (or any of the JetBrains stuff) as Administrator, it creates files as Administrator, and then you can't access the files in other tools (like the command line Subversion client, for example).

However, I recently started using JetBrains Toolbox to upgrade the JetBrains apps. If you start that App from Toolbox, it runs as Administrator, leaving you a bunch of files in your Workspace that you can't access as non-Administrator.

Oodles answered 31/8, 2017 at 12:34 Comment(0)
B
2

I get the error on a project that I placed on a Google Drive sync'd folder. I turn Google Drive off and the issue goes away. The issue was with the .ideas folder.

Billingsgate answered 24/7, 2016 at 11:5 Comment(1)
Have you found any ways around this without turning off Google Drive? @Troy WraySabadilla
A
2

If it's not a permission issue, it can be the case that you don't have free space left anymore. So check the size of the hard drive where you pyCharm is.

Adalia answered 12/9, 2019 at 2:43 Comment(0)
F
1

Since you are using the community edition, my answer almost certainly does not apply to you but it might help others arriving here with the same error.

In my case, there was some problem with the nfs share I use to synchronize between the remote server and my local setup. File and directory permissions on the remote server were all fine. After a umount <my_nfs_dir> and remount, PyCharm was able to save settings and stopped complaining.

Follansbee answered 6/6, 2016 at 3:33 Comment(0)
P
1

It's having trouble saving, not the file, but it's own configuration to the .idea directory, usually in the same folder as the root of the project. I'm here because I've restored a backup and the reinstalled pycharm isn't happy with it. Although I lost the project settings (no big deal). This fixed it.

Eg:

$ cd myproject
$ rm -rf .idea
Panicstricken answered 29/10, 2018 at 9:43 Comment(0)
I
0

I had this problem on windows. it started when switching from 2016 to 2017. I fixed it with:

start -> pycharm -> right click -> run as admin

It did whatever it needed to do. Then I closed and relaunched (not as admin) and the error went away.

Illume answered 13/1, 2018 at 2:12 Comment(0)
T
0

If you're on Windows 10 and have Windows Ransomware Protection on (for the folder in which your project resides), go to:

Windows Security > Virus & threat protection > Allow an app through Controller folder access

And allow PyCharm executable to make changes to your files.


If you have any other type of anti-virus or software that limits access to files, you will want to add PyCharm to their exception lists as well.

Terebinthine answered 9/6, 2019 at 23:5 Comment(0)
L
0

EventLog Notification Window(click the wrench icon) -> "Settings Error", choose "no popup", uncheck "log" I tried above methods, none doesn't work except this ostrichish ignorance method.

Leonardaleonardi answered 25/6, 2020 at 4:4 Comment(0)
I
0

I tried to fix the problem in Ubuntu as follows:

First Step: Move to the directory location.

cd PATH/OF/Directory

Second Step: Make project directory to be readable with permissions.

sudo chown -R 777 project
sudo chmod -R 777 project
  • Replace 'project' directory with your directory/folder.

Best Of Luck!

Indistinct answered 19/11, 2020 at 11:23 Comment(0)
C
0

I have a problem too and i fixed it

when you open pycharm choose -> Run as Administrator

Cryptocrystalline answered 18/5, 2024 at 2:5 Comment(1)
This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. To get notified when this question gets new answers, you can follow this question. Once you have enough reputation, you can also add a bounty to draw more attention to this question. - From ReviewBankbook
S
-1

I had the same problem but I solved it by running it as a super user, ex. In Kali Linux I tried

sudo i

then I enter the pass and then I run it like this

/Documents/pycharm-2020.1.1/bin# 
./pycharm.sh`

I think pycharm need super user

Scherer answered 2/6, 2020 at 4:3 Comment(0)
R
-2

I just change the owner to the project folder, now is working fine, I'm using Ubuntu 19.04 and pycharm

chown -R username:root projectfolder/
Ricard answered 20/9, 2019 at 19:40 Comment(0)
Q
-2

I just rebooted. That solved it.

Quondam answered 24/11, 2023 at 16:47 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.