Skip to content

Conversation

@Tseian
Copy link
Contributor

@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 18 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
Contributor Author

Tseian commented Dec 24, 2025

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

@Tseian
Copy link
Contributor 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
Contributor 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
Contributor Author

Tseian commented Dec 25, 2025

That sounds reasonable to me. 🙂

Got it. I will commit it soon.

@Tseian
Copy link
Contributor 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
Contributor 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
Contributor 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
Contributor 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

@avivkeller avivkeller added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 1, 2026
@nodejs-github-bot nodejs-github-bot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jan 1, 2026
@nodejs-github-bot
Copy link
Collaborator

Commit Queue failed
- Loading data for nodejs/node/pull/61164
✔  Done loading data for nodejs/node/pull/61164
----------------------------------- PR info ------------------------------------
Title      process: improve process.cwd() error message (#61164)
Author     TseIan <tseianxwc@gmail.com> (@Tseian, first-time contributor)
Branch     Tseian:improve-err-msg -> nodejs:main
Labels     c++, author ready
Commits    6
 - process: improve process.cwd() error message
 - process: add notice message when process.cwd() failed.
 - process: fix cpp format issue
 - process: fix cpp format issue
 - process: remove std::string
 - process: format cpp
Committers 1
 - TseIan <tseianxwc@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
--------------------------------------------------------------------------------
   ℹ  This PR was created on Wed, 24 Dec 2025 04:43:35 GMT
   ✔  Approvals: 3
   ✔  - Stephen Belanger (@Qard): https://github.com/nodejs/node/pull/61164#pullrequestreview-3617532299
   ✔  - theanarkh (@theanarkh): https://github.com/nodejs/node/pull/61164#pullrequestreview-3618787231
   ✔  - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/61164#pullrequestreview-3614923158
   ✔  Last GitHub CI successful
   ℹ  Last Full PR CI on 2025-12-30T08:14:48Z: https://ci.nodejs.org/job/node-test-pull-request/70629/
- Querying data for job/node-test-pull-request/70629/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
--------------------------------------------------------------------------------
   ✔  No git cherry-pick in progress
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/main up to date...
From https://github.com/nodejs/node
 * branch                  main       -> FETCH_HEAD
✔  origin/main is now up-to-date
- Downloading patch for 61164
From https://github.com/nodejs/node
 * branch                  refs/pull/61164/merge -> FETCH_HEAD
✔  Fetched commits as d991f690df76..752b571ee1a2
--------------------------------------------------------------------------------
[main 49ab8a6ebf] process: improve process.cwd() error message
 Author: TseIan <tseianxwc@gmail.com>
 Date: Sun Dec 21 18:38:29 2025 +0800
 3 files changed, 35 insertions(+), 3 deletions(-)
 create mode 100644 test/parallel/test-cwd-enoent-improved-message.js
[main 5099f164f5] process: add notice message when process.cwd() failed.
 Author: TseIan <tseianxwc@gmail.com>
 Date: Fri Dec 26 08:02:11 2025 +0800
 3 files changed, 12 insertions(+), 4 deletions(-)
[main e0a9fc028d] process: fix cpp format issue
 Author: TseIan <tseianxwc@gmail.com>
 Date: Sat Dec 27 08:34:31 2025 +0800
 1 file changed, 1 insertion(+), 1 deletion(-)
[main bcb5f57734] process: fix cpp format issue
 Author: TseIan <tseianxwc@gmail.com>
 Date: Sat Dec 27 17:16:37 2025 +0800
 1 file changed, 2 insertions(+), 1 deletion(-)
[main e792c1253f] process: remove std::string
 Author: TseIan <tseianxwc@gmail.com>
 Date: Mon Dec 29 21:32:01 2025 +0800
 1 file changed, 2 insertions(+), 2 deletions(-)
[main db0c830e2c] process: format cpp
 Author: TseIan <tseianxwc@gmail.com>
 Date: Mon Dec 29 23:06:34 2025 +0800
 1 file changed, 3 insertions(+), 4 deletions(-)
   ✔  Patches applied
There are 6 commits in the PR. Attempting autorebase.
(node:2682) [DEP0190] DeprecationWarning: Passing args to a child process with shell option true can lead to security vulnerabilities, as the arguments are not escaped, only concatenated.
(Use `node --trace-deprecation ...` to show where the warning was created)
Rebasing (2/12)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
process: improve process.cwd() error message

PR-URL: #61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

[detached HEAD e1a18d9379] process: improve process.cwd() error message
Author: TseIan <tseianxwc@gmail.com>
Date: Sun Dec 21 18:38:29 2025 +0800
3 files changed, 35 insertions(+), 3 deletions(-)
create mode 100644 test/parallel/test-cwd-enoent-improved-message.js
Rebasing (3/12)
Rebasing (4/12)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
process: add notice message when process.cwd() failed.

PR-URL: #61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

[detached HEAD 35511bb950] process: add notice message when process.cwd() failed.
Author: TseIan <tseianxwc@gmail.com>
Date: Fri Dec 26 08:02:11 2025 +0800
3 files changed, 12 insertions(+), 4 deletions(-)
Rebasing (5/12)
Rebasing (6/12)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
process: fix cpp format issue

PR-URL: #61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

[detached HEAD 377284315c] process: fix cpp format issue
Author: TseIan <tseianxwc@gmail.com>
Date: Sat Dec 27 08:34:31 2025 +0800
1 file changed, 1 insertion(+), 1 deletion(-)
Rebasing (7/12)
Rebasing (8/12)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
process: fix cpp format issue

PR-URL: #61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

[detached HEAD 0ab26d723f] process: fix cpp format issue
Author: TseIan <tseianxwc@gmail.com>
Date: Sat Dec 27 17:16:37 2025 +0800
1 file changed, 2 insertions(+), 1 deletion(-)
Rebasing (9/12)
Rebasing (10/12)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
process: remove std::string

PR-URL: #61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

[detached HEAD 533db1d1cd] process: remove std::string
Author: TseIan <tseianxwc@gmail.com>
Date: Mon Dec 29 21:32:01 2025 +0800
1 file changed, 2 insertions(+), 2 deletions(-)
Rebasing (11/12)
Rebasing (12/12)
Executing: git node land --amend --yes
--------------------------------- New Message ----------------------------------
process: format cpp

PR-URL: #61164
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: theanarkh <theratliter@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>

[detached HEAD 942950e335] process: format cpp
Author: TseIan <tseianxwc@gmail.com>
Date: Mon Dec 29 23:06:34 2025 +0800
1 file changed, 3 insertions(+), 4 deletions(-)
Successfully rebased and updated refs/heads/main.

ℹ Add commit-queue-squash label to land the PR as one commit, or commit-queue-rebase to land as separate commits.

https://github.com/nodejs/node/actions/runs/20639737695

@theanarkh theanarkh added commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Jan 1, 2026
@Qard Qard added the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 2, 2026
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Jan 2, 2026
@nodejs-github-bot nodejs-github-bot merged commit 3518af0 into nodejs:main Jan 2, 2026
82 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 3518af0

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

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants