This file does not belong to the project...

So I had to delete some directories and move data to a different location before traveling this weekend. I saved my .ipynb, git commit to GitHub, and left for the weekend. I was able to pull it down with zero issues to my laptop and work on it. PyCharm professional edition 2021.2.2 PY-212.5284.44

Now I get back home, git clone the .ipynb from GitHub to a newly created folder and I get the error. Why doesn't the file belong to the project and why is this such a worthless error message. Why can't they create a link within the error message that links to possible solutions or some kind of "reload, redo or fix this thing"

Nope, what I get is "This file does not belong" no recommendations, no hints, or no help.

So I google the error and find "File > Invalidate Caches" is a recommendation, which I do and restart to no change.

I'm starting to feel like PyCharm is an episode of Seinfield "Software is only helpful if it works, so when it doesn't work it's intelligently designed to give you clues"

What we need is "Hello human you broke my Blah Blah function, go to preferences and load project file ABC.file" Software needs to give you an error that tells you something, anything remotely helpful on how to fix it.

You could also think ahead and solve part of the problem via "Hello human you broke my Blah Blah function, click here to post an error post to my genius creators and include screenshot of my Fizz Buzz settings in File>Settings>FizzBuzz"


How I worked around the issue ...   I found that my Preferences --> Project --> Project Structure --> Content Root had completely disappeared!   Even so it was hard to track down because some files were editable and some were not, with no rhyme or reason why one file could be edited and another could not.  So I re-established the Content Root directory for the project, cleared the caches as suggested, and restarted PyCharm.   Now I can edit again.

I will provide an update if I can somehow re-produce this issue.   Hope this helps someone out there.



Should I be saving my .idea and other files somewhere because I am testing software for school and can't have this stuff happen again? Should I be saving my data differently, should I be using a docker or how can I move data, wipe the disk or directory and test a reinstall of python and not have the script crash. How to overcome that aspect?

This is a fundamental basic aspect of software development, installing on a new location and it seems like I've missed a meeting about "oh make sure you save your critical interpreter settings to the blah blah file"

Which brings up a second issue, why does it take so long to index a file? Can't I save the index somehow and instead of rescanning the whole thing it just updates the index like a git diff?


Ok, I went to my portable hard drive and found the files I saved because I always keep a backup and deleted the whole new directory. Poof, It reindexed and is back up.

I still don't know why this error code keeps coming up, these error codes are impotent unless you know "what to know". I have to google them, spend your valuable time posting here only to have you tell me what you have probably told 14 people that month again.

What is a PyCharm module? Is it a file, a setting a configuration?




I am very sorry for the disappointing  experience. 


>The file does not belong to the project

I am wondering if there were any changes which triggered this error appearance? Could you please share the steps so I will be able to reproduce and report the behaviour. 

>Which brings up a second issue, why does it take so long to index a file? 

Indexing scans the interpreter files and whole Project root. How log does it take? It may take some time as  it depends on the project size. 


>I still don't know why this error code keeps coming up, these error codes are impotent unless you know "what to know".

Could you please attach a screenshot of the error? 



Hi JetBrains and Community.

I have this same issue.   Don't know why it started.   Is there any resolution to this issue?



This happened to me, so I rm -rf the project folder and restarted the IDE and no change.  I tried File, Invalidate Caches, and no change.  Finally, I tried File, Reapir IDE... and after the 3rd step everything's working.



For me the problem was opening the project originally from a different dropbox path.... once I reopened the project from the Dropbox (Personal) path then the content root and debug paths were consistent. 


Please sign in to leave a comment.