Fixing the 'Unable to resolve workspace folder' Error in VS Code

beginner๐Ÿ’ป VS Code2026-04-24| Windows, macOS, Linux - VS Code (All versions)

Error Message

Unable to resolve workspace folder
#vscode#workspace#folder#settings

The Problem

I recently ran into a frustrating issue where VS Code suddenly refused to load my project folders. Instead of my files appearing in the sidebar, I was greeted with a notification stating: Unable to resolve workspace folder. This usually happens when you are using a Multi-Root Workspace or a .code-workspace file, and VS Code can no longer find one of the directories defined in that configuration.

This error is particularly common after moving folders around on your hard drive, renaming a parent directory, or if you're working with project files stored on an external drive or a network mount that hasn't been connected yet.

Why this happens

When you save a workspace in VS Code, it creates a JSON file with a .code-workspace extension. This file contains absolute or relative paths to your project folders. If any of those paths become invalid, VS Code throws the Unable to resolve workspace folder error because it doesn't want to show you an empty or broken environment.

Common triggers:

  • Renaming the project folder outside of VS Code.
  • Moving the .code-workspace file to a different directory level.
  • Unmounted network drives or disconnected USB storage.
  • Deleting a folder that was part of a multi-root setup.

Step-by-Step Fixes

1. Manually Edit the .code-workspace File

The fastest way to fix this is to go straight to the source. If you can still open the workspace file itself, do that. If not, find it in your file explorer and open it with a text editor (even Notepad or Vim will do).

{
    "folders": [
        {
            "path": "frontend"
        },
        {
            "path": "../backend-api"
        },
        {
            "name": "Docs",
            "path": "/Users/dev/documents/project-notes"
        }
    ],
    "settings": {}
}

Look at the path values. Check if those directories actually exist at those locations. If you moved the backend folder, update the path here. If you are on Windows, ensure the drive letter (e.g., D:) is correct.

2. Use Relative Paths Instead of Absolute Paths

I've found that using absolute paths (like C:\Users\Admin\Project) is a recipe for disaster if you share your workspace file with teammates or move between machines. Switch to relative paths whenever possible.

If your .code-workspace file is in the root of your project, your paths should look like this:

"folders": [
    {
        "path": "."
    },
    {
        "path": "packages/api"
    }
]

3. Remove and Re-add the Folder

If editing the JSON feels too manual, you can fix it through the VS Code UI (if the window stays open):

  • Right-click the broken folder in the Explorer side pane (it usually has a small 'x' or warning icon).
  • Select Remove Folder from Workspace.
  • Go to File > Add Folder to Workspace... and navigate to the new location of that folder.
  • Save the workspace again (File > Save Workspace As...).

4. Check Network and External Mounts

On Linux and macOS, I often see this error when a Docker volume or an NFS mount isn't active. If your workspace path points to /mnt/data/projects, run a quick check in your terminal:

ls /mnt/data/projects

If you get a "No such file or directory" error, you need to remount your drive before VS Code can resolve the workspace folder.

5. Clear VS Code Workspace Storage

Sometimes VS Code gets stuck on a cached version of a workspace that no longer exists. If you've deleted the .code-workspace file but VS Code keeps trying to open it at startup, you might need to clear the internal state.

Navigate to the global storage folder for VS Code and look for the workspaceStorage directory. You can try deleting the folders inside (warning: this will reset your UI state like open tabs and window sizes for those projects).

  • Windows: %APPDATA%\Code\User\workspaceStorage\
  • macOS: ~/Library/Application Support/Code/User/workspaceStorage/
  • Linux: ~/.config/Code/User/workspaceStorage/

Verify the Fix

Once you have updated the paths or remounted your drives, here is how to confirm everything is back to normal:

  • Close all VS Code instances.
  • Open your terminal and type code path/to/your/project.code-workspace.
  • Check the Explorer sidebar (Ctrl+Shift+E or Cmd+Shift+E). All folders should now be expanded without error icons.
  • Try to run a "Search in Files" (Ctrl+Shift+F). If it returns results from all folders, the workspace resolution is fully functional.

Tips for Preventing Path Issues

  • Keep it local: Try to keep all folders in a multi-root workspace under the same parent directory so you can use simple relative paths.
  • Git ignore: If you use absolute paths because of your specific machine setup, add your *.code-workspace files to .gitignore so you don't break your colleagues' environments.
  • Use Symbolic Links: If you must have folders in weird locations, create a symlink inside your main project folder that points to the external location. VS Code handles symlinks much better than broken workspace definitions.

Related Error Notes