Skip to content

Renaming file causes FileNotFoundException on java language server start #154

Closed

Description

@panzer-planet

##[provide a description of the issue]

Environment
  • Operating System: 10.12.2
  • JDK version: jdk1.8.0_121
  • Visual Studio Code version: 1.9.1
  • Java extension version: 0.0.10
Steps To Reproduce
  1. Rename a file and folder of package
    In my case it was
    android/app/src/main/java/za/co/io/reactnativekeystore/KeystoreModule.java android/app/src/main/java/za/co/io/reactnativekeystore/KeystorePackage.java
    and I renamed them to
    android/app/src/main/java/za/co/io/reactnativecrypto/CryptoModule.java android/app/src/main/java/za/co/io/reactnativecrypto/CryptoPackage.java
  2. Restart VSCode
  3. Language server fails to start throwing FileNotFoundException

Purging ~/Library/Application Support/Code/User/workspaceStorage and restarting VSCode solved the problem

Activity

  1. fbricon commented on Feb 14, 2017

    @fbricon
    Collaborator

    I can't reproduce this issue. Could you please paste a complete stacktrace?

  2. Kyasaki commented on Mar 13, 2017

    @Kyasaki

    I have the same issue: I created a folder src and moved all my files inside, but the extension keeps looking for the file at the project root whenever i close/reopen vscode.

    File not found: C:\cygwin64\home\Kyasaki\etna2\tic\djav\proj\Main.java.

    (Path is now C:\cygwin64\home\Kyasaki\etna2\tic\djav\proj\ src \Main.java.

  3. fbricon commented on Mar 13, 2017

    @fbricon
    Collaborator

    Try the following steps:

    • close VS code
    • delete %APPDATA%\Code\User\workspaceStorage\.
    • restart
  4. Kyasaki commented on Mar 14, 2017

    @Kyasaki

    Deleting the workspaceStorage greatly works for me 👍
    Doing it manually therefore is a little bit ugly :/

  5. kirilloid commented on Jun 28, 2017

    @kirilloid

    The problem still exists—"file not found" errors in console for renamed/removed files—and is still fixable the same way, workspaceStorage: del /s /q %APPDATA%\Code\User\workspaceStorage\ with closed VS code

    Operating System: Win 10 Enterprise 14393.1358
    JDK version: jdk1.8.0_121
    Visual Studio Code version: 1.13.1
    Java extension version: 0.6.0

  6. Dasky14 commented on Oct 13, 2017

    @Dasky14

    I'm going to say that I still have this same issue, solved by the manual deletion of workspaceStorage.
    Looks like it just doesn't make a simple check whether the file exists or not, and errors out when it tries to load it.

    Operating System: Win 10 Pro 15063.674
    JDK version: 1.8.0_144
    VScode: 1.17.1
    Java extension version: 0.11.0

  7. kevin-he-01 commented on Jan 9, 2018

    @kevin-he-01

    Same issue here [REDACTED] when I tried to move/rename a folder/file.
    As it's impossible for VS Code to support Alias feature of macOS that tracks the path of any file, it must use symbolic link which broke when any folder in the path is renamed, so I removed the folder from the workspace and readied it after renaming.
    However, what I don't realize is that the Java Language Server still sticks to the path to the file even after it's removed from the workspace! I tried restarting VS Code and even Reinstalling the whole extension pack but neither of them helped — the error persists. Thanks you for your fix 🙂 as I cannot find it anywhere else.
    It must be a problem that it is saving caches to the disk folder "workspaceStorage" which contains the path to the source files
    [REDACTED]
    I think VS Code should add a move/rename folder/file feature

    Operating System: macOS High Sierra 10.13.2
    JDK version: JDK9
    VSCode: 1.19.1
    Java extension version: 0.16.0

    Error log when I tried to move the folder "Java Test" from ~/No Sync/Java Testing/Java Test to ~/Desktop/Java Test:
    VS Code Java Extension By Red Hat Error log.txt

    Note: I edited this comment and removed unnecessary information and added logs

  8. robstryker commented on Oct 28, 2026

    @robstryker
    Contributor

    No activity on this issue since 2018, so, I'll be closing this unless someone indicates it's still an issue for them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions