thomas-pedersen / cursor-chat-browser

A web application for browsing and managing chat histories from the Cursor editor's AI chat feature. View, search, and export your AI conversations in various formats.
68 stars 9 forks source link

Failed to get workspaces: [Error: ENOENT: no such file or directory, scandir ''] #4

Open merewords opened 2 weeks ago

merewords commented 2 weeks ago

Hi

Running on Windows11 Version 10.0.22621 Build 22621 I get this error despite the workspaces existing in the autodetected and configured workspaceStorage location

The link just displays image

Here is the configuration page image

File explorer confirming the workspaces exits in this location image

And the next-server output image

Any idea what causes this error?

Marc

duythvn commented 2 weeks ago

following as I got the same error

runekaagaard commented 2 weeks ago

+1 On Ubuntu Linux

johanndiedrick commented 2 weeks ago

+1 I get the same error! On MacOS

zixinzuofo commented 1 week ago

+1 On WSL I tried to locate the file containing "Failed to get workspaces:" and found that it is "src/app/api/workspaces/route.ts". image The error seems to be due to the WORKSPACE_PATH environment variable not being set. image I then exported WORKSPACE_PATH="/mnt/c/Users/USERNAME/AppData/Roaming/Cursor/User/workspaceStorage" in my terminal, and everything is working fine now!

merewords commented 1 week ago

Thank you @zixinzuofo for the pointer... I worked around this issue as follows:

Install dotenv (if not already installed): npm install dotenv

Create a .env File (if it doesn’t exist) in the root of this project folder and add your workspaceStorage path - this is mine: WORKSPACE_PATH=C:\Users\MW\AppData\Roaming\Cursor\User\workspaceStorage

Load the .env File in your route.ts: Add this line at the top of the file to load environment variables: import 'dotenv/config';

Access the Variable: The route.ts will now read the value of WORKSPACE_PATH from .env using the original code: (nothing to change if you have the following near the top of route.ts) const workspacePath = process.env.WORKSPACE_PATH || '';

This got it working for me until someone finds a better fix

Marc

runekaagaard commented 1 week ago

Yeah this works on linux, thx guys!:

WORKSPACE_PATH=~/.config/Cursor/User/workspaceStorage npm run dev
jmpavlick commented 1 week ago

I'm on macOS.

I noticed that I needed to both set WORKSPACE_DIRECTORY to my fully-qualified path - i.e., given that my local user is john, I needed to set it to /Users/john/Library/Application Support/Cursor/User/workspaceStorage -

and I needed to set the Cursor Workspace Path value in the webapp config to the same value.

Using a ~/ to reference my home folder seems to not work; I suspect that it's not being expanded. Or something. I don't know.

But from zsh, I run

WORKSPACE_DIRECTORY="/Users/john/Library/Application Support/Cursor/User/workspaceStorage" npm run dev

and it works!

SandroPacella commented 1 week ago

set it to /Users/john/Library/Application Support/Cursor/User/workspaceStorage

Thank you @jmpavlick. That was enough to fix the issue for me on macOS.

thomas-pedersen commented 6 days ago

a fix has been merged, let me know if still an issue