Skip to content

Conversation

@Tseian
Copy link

@Tseian Tseian commented Dec 24, 2025

Issue

#57045

Description

Improves the error message when process.cwd() failed by adding prefix err message 'process.cwd failed with error' if call uv_cwd failed

Before

Error: ENOENT: no such file or directory, uv_cwd

After

ENOENT: process.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd

Changes

  • src/node_process_methods.cc

Test

  • test/known_issues/test-cwd-enoent-file.js
  • test/parallel/test-cwd-enoent-improved-message.js

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. labels Dec 24, 2025
@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.53%. Comparing base (05d6b9b) to head (752b571).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #61164   +/-   ##
=======================================
  Coverage   88.53%   88.53%           
=======================================
  Files         703      703           
  Lines      208599   208605    +6     
  Branches    40229    40229           
=======================================
+ Hits       184685   184695   +10     
+ Misses      15939    15935    -4     
  Partials     7975     7975           
Files with missing lines Coverage Δ
src/node_process_methods.cc 88.84% <100.00%> (+0.14%) ⬆️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Tseian Tseian force-pushed the improve-err-msg branch 2 times, most recently from 4df8170 to 6dfc827 Compare December 24, 2025 14:06
@Tseian
Copy link
Author

Tseian commented Dec 24, 2025

@theanarkh @joyeecheung Please trigger the ci to check again.

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

@joyeecheung @legendecas @Qard @theanarkh Pls code review this pr

@Qard
Copy link
Member

Qard commented Dec 25, 2025

My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a cwd() call. What's not obvious is why.

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

My thinking with reporting the issue initially was that we could provide a bit more expanded context explaining what the cause could be, like stating that the current working directory was likely removed without changing the working directory to something else. It's already I think obvious enough that the error is coming from a cwd() call. What's not obvious is why.

@Qard So, would changing the error message to "ENOENT: process.cwd failed with error no such file or directory, the current working directory was likely removed without changing the working directory, uv_cwd" achieve it?

@Qard
Copy link
Member

Qard commented Dec 25, 2025

That sounds reasonable to me. 🙂

@Tseian
Copy link
Author

Tseian commented Dec 25, 2025

That sounds reasonable to me. 🙂

Got it. I will commit it soon.

@Tseian
Copy link
Author

Tseian commented Dec 26, 2025

@Qard Hi, I have committed it. Please have a code review for it, and if there is no issue please trigger the CI to check again.

@Tseian
Copy link
Author

Tseian commented Dec 27, 2025

@Qard If you have time, please help trigger a CI to check and review the pr. Thank you very much😊.

@Qard Qard added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 27, 2025
@github-actions github-actions bot added request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Dec 27, 2025
@github-actions
Copy link
Contributor

Failed to start CI
   ⚠  Commits were pushed since the last approving review:
   ⚠  - process: improve process.cwd() error message
   ⚠  - process: add notice message when process.cwd() failed.
   ⚠  - process: fix cpp format issue
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/20535988465

@Tseian
Copy link
Author

Tseian commented Dec 27, 2025

@Qard Sorry to bother you again. The CI checks for the cpp format failed. My bad. I have fixed the issue. Could you please trigger the CI to check and CR again?

@Qard Qard added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci-failed An error occurred while starting CI via request-ci label, and manual interventon is needed. labels Dec 27, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 27, 2025
@nodejs-github-bot
Copy link
Collaborator

@Tseian
Copy link
Author

Tseian commented Dec 29, 2025

image

@addaleax It is confusing that the three ci actions are pending in running status for 2 days. Could you please help to trigger it again?

@Qard Qard added request-ci Add this label to start a Jenkins CI on a PR. and removed needs-ci PRs that need a full CI run. labels Dec 30, 2025
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 30, 2025
@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants