Skip to content

Conversation

@PriyanshusinghPanda
Copy link

Description

Improves the error message when process.cwd() fails because the current working directory no longer exists (e.g., was deleted).

Before


Error: ENOENT: no such file or directory, uv_cwd

After


Error: current working directory does not exist: process.cwd() failed because the directory was deleted

Changes

  • Modified lib/internal/bootstrap/switches/does_own_process_state.js to catch and enhance the ENOENT error message in wrappedCwd()
  • Added test/parallel/test-cwd-enoent-improved-message.js to verify the improved error message

Testing

  • ✅ All existing tests pass
  • ✅ New test added and passing
  • ✅ Linter passed
  • ✅ Manual verification successful
  • ✅ Backward compatibility maintained (error code and properties unchanged)

Fixes

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/startup

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

process.cwd() fails in a not usefully descriptive way

2 participants