VS Code Terminal CWD Error Fix
Problem
The terminal process failed to launch: Starting directory (cwd) "/workspaces/loan-defenders" does not exist.
Root Cause
The .vscode/settings.json contained hardcoded Dev Container paths (/workspaces/loan-defenders) that don't exist when working locally on macOS, Windows, or Linux.
Solution
Use VS Code workspace variables instead of hardcoded paths for cross-platform compatibility.
Fixed Configuration
Before (Dev Container-specific):
{
"python.defaultInterpreterPath": "/workspaces/loan-defenders/.venv/bin/python",
"terminal.integrated.cwd": "/workspaces/loan-defenders"
}
After (Cross-platform):
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python",
"terminal.integrated.cwd": "${workspaceFolder}"
}
How It Works
${workspaceFolder}- VS Code built-in variable that resolves to:/Users/niksac/github/loan-defenders(macOS local)/workspaces/loan-defenders(Dev Container)C:\Users\username\github\loan-defenders(Windows local)/home/username/github/loan-defenders(Linux local)
Files Updated
.vscode/settings.json- Changed to use${workspaceFolder}variable.devcontainer/post-create.sh- Updated to generate cross-platform settingsapps/api/pyproject.toml- Removed hardcoded coverage path
Verification
- Reload VS Code:
Cmd+Shift+P→ "Developer: Reload Window" - Open new terminal: Should open in workspace root without errors
- Test in Dev Container: Settings work in both local and containerized environments
Prevention
- Never use absolute paths in
.vscode/settings.json - Always use VS Code variables:
${workspaceFolder},${workspaceFolderBasename}, etc. - Test locally before committing Dev Container configurations
Related Documentation
Fixed: October 18, 2025
Impact: Local development on macOS, Windows, Linux, and Dev Containers