This file does not belong to the project...?

I know I must have read about this somewhere but...when I'm in break-mode and I see where I want to edit the code , maybe in a different file to the one with the break in, I get the "This file does not belong" message. In the PHPStorm header it shows the path as the origin of the symlink, but so are all the files I work on and i don't get the complaint about them.

If i do edit the file the editor has an issue between the file I've edited (I guess its holding in memory) and the on one on disk...?

To work on the correct file I have to go to the project explorer and select the file again thru that, which is a pain...what am I don't wrong? 

Comment actions Permalink

Could you please attach screenshots of your directory structure and the IDE window including the path when you get the error?
It's hard to understand how you open a file that can't be edited properly. Thanks!

Comment actions Permalink

Hi, sorry delay for posting but here are two pic's showing the same file, the first one after just having stopped the debugger, note the file path in the IDE header:

and then after clicking on the file in the Project Explorer - not much to show but the IDE header/file path:

The second one without the problem is showing the relative path in the IDE header.

I would add that I'm having the same behaviour with Linux as I was with Windows.

Comment actions Permalink

Thanks for sharing the screenshot.

As far as I see fro a window title, the file is located in /vendor/ directory, right?

Could you please check if this directory is marked as excluded in "Settings > Directories"?

Comment actions Permalink

Yes, but the problem is , its a vendor folder nowhere near the project folder, its been symlinked in. Should i add it anyway? 

It seems that sometimes phpstorm chooses to use the symlinked destination path (in the project folder) and its ok, but other times it uses the 'real path' and then doesn't like it.

Comment actions Permalink

Maybe it's worth adding debugging mappings? When PhpStorm gets a debugging connection, the Xdebug sends original paths to it, and PhpStorm just doesn't understand how the original files correspond to the symlinked project files.

Please describe that at Settings | Languages & Frameworks | PHP | Servers.

Comment actions Permalink

I get the same sort of error in PyCharm 2020.1 EAP (Professional Edition)

I have ~/PycharmProjects symlinked to /opt/code/PycharmProjects 

When I get a Traceback (stacktrace) it shows the file paths under /opt/code.  When I click on the filename to see the problem spot, I often get the dialog box for "non-Project Files Protection" saying "this file does not belong to the project".  The popup does not occur until I try to actually edit the file in question.

The files are part of the project and are included in the git files handling.


PyCharm 2020.1 EAP (Professional Edition)
Build #PY-201.5259.14, built on February 12, 2020
PyCharm EAP User
Expiration date: March 13, 2020
Runtime version: 11.0.6+8-b722.2 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 3.10.0-1062.12.1.el7.x86_64
GC: ParNew, ConcurrentMarkSweep
Memory: 1970M
Cores: 4
Non-Bundled Plugins:

Comment actions Permalink

Correct me if I am wrong but isn't the IDE right that files are out of the project if these are located under "/opt/code/" whereas the project is located at "/opt/code/PycharmProjects" or I misunderstood your scenario?

Comment actions Permalink

Depends a bit on how you look at it. 

 - All the project code is under "/opt/code/PycharmProjects", due to it being soft linked to my home.

 - PyCharm is the one that followed the symlink to the actual location and then displayed the file when I clicked on the Traceback.

Comment actions Permalink

Bob Jones, if I get it right, this is the issue you are having:
And it's claimed to be fixed in 2019.3. If it's not working properly in 2020.1, just as you say, probably it makes sense to submit another bug report to the PyCharm tracker:


Please sign in to leave a comment.