Fixing Path Separator Issues in Cursor AI’s SQLite Database
Issue Description
Cursor AI occasionally stores Windows-style backslash paths (\
) instead of Unix-style forward slashes (/
) for remote SSH workspace files. This can cause issues with file handling and navigation.
Location of the Issue
The path information is stored in SQLite database:
- Path:
%APPDATA%\Cursor\User\workspaceStorage\{workspace-id}\state.vscdb
- Table:
ItemTable
- Key locations:
- composer.composerData (JSON field)
- memento/workbench.parts.editor (JSON field)
Diagnostic Commands
1. Check Tables
^^^powershell
sqlite3 state.vscdb “.tables”
^^^
2. Find Problematic Paths
^^^powershell
Check for backslash paths
sqlite3 state.vscdb “.mode line” “SELECT key, value
FROM ItemTable
WHERE value LIKE ‘%\var\www%’;”
Check specific composer data
sqlite3 state.vscdb “.mode line” “SELECT key, value
FROM ItemTable
WHERE key = ‘composer.composerData’;”
^^^
Fix Commands
1. Always Backup First
^^^powershell
Copy-Item state.vscdb state.vscdb.backup
^^^
2. Fix Composer Data
^^^powershell
Fix specific composer entry
sqlite3 state.vscdb "
UPDATE ItemTable
SET value = json_replace(
value,
‘$.allComposers[4].forceMode[0].fsPath’,
‘/var/www/html/autopop.icybox.de/doc/prd/prd-workflow-template-v02.md’
)
WHERE key = ‘composer.composerData’;"
^^^
3. Fix Workbench Editor State
^^^powershell
Fix workbench paths
sqlite3 state.vscdb "
UPDATE ItemTable
SET value = REPLACE(
value,
‘\\var\\www\\html\\autopop.icybox.de\\doc’,
‘/var/www/html/autopop.icybox.de/doc’
)
WHERE key = ‘memento/workbench.parts.editor’;"
^^^
Verification Commands
1. Check Composer Data
^^^powershell
sqlite3 state.vscdb “.mode line” “SELECT json_extract(value, ‘$.allComposers[4].forceMode[0].fsPath’) as current_path,
json_extract(value, ‘$.allComposers[4].forceMode[0].path’) as reference_path
FROM ItemTable
WHERE key = ‘composer.composerData’;”
^^^
2. Check for Any Remaining Backslash Paths
^^^powershell
sqlite3 state.vscdb “.mode line” “SELECT key, value
FROM ItemTable
WHERE value LIKE ‘%\var\www\html\autopop%’
OR value LIKE ‘%\\var\\www\\html\\autopop%’;”
^^^
Important Notes
- Always make a backup before modifying the SQLite database
- Close Cursor AI before making changes
- The database structure uses both
ItemTable
andcursorDiskKV
tables - Path information can be stored in multiple formats:
- Direct paths with forward/backslashes
- URI encoded paths (vscode-remote://ssh-remote%2B…)
- JSON encoded paths in configuration objects
Troubleshooting
If issues persist:
- Check if Cursor AI is completely closed
- Verify the workspace ID is correct
- Ensure all paths in the database are consistent
- Restart Cursor AI after making changes
Prevention
Currently, there’s no direct way to prevent Cursor AI from occasionally storing Windows-style paths. The issue seems to occur during the translation between local Windows environment and remote SSH connections.