Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Qard opened this issue Feb 14, 2025 · 1 comment
Open

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

Qard opened this issue Feb 14, 2025 · 1 comment
Labels
confirmed-bug Issues with confirmed bugs. good first issue Issues that are suitable for first-time contributors. process Issues and PRs related to the process subsystem.

Comments

@Qard
Copy link
Member

Qard commented Feb 14, 2025

Version

22.14.0

Platform

macOS Sequoia 15.1.1

Subsystem

process

What steps will reproduce the bug?

~/Code/platformatic via  v22.14.0 on ☁️  (us-east-1)
❯ mkdir lol

~/Code/platformatic via  v22.14.0 on ☁️  (us-east-1)
❯ cd lol

Code/platformatic/lol on ☁️  (us-east-1)
❯ rm -rf ../lol

Code/platformatic/lol on ☁️  (us-east-1)
❯ node -p "process.cwd()"
node:internal/bootstrap/switches/does_own_process_state:142
    cachedCwd = rawMethods.cwd();
                           ^

Error: ENOENT: no such file or directory, uv_cwd
    at process.wrappedCwd [as cwd] (node:internal/bootstrap/switches/does_own_process_state:142:28)
    at [eval]:1:9
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:449:12
    at [eval]-wrapper:6:24
    at runScriptInContext (node:internal/process/execution:447:60)
    at evalFunction (node:internal/process/execution:87:30)
    at evalScript (node:internal/process/execution:99:3)
    at node:internal/main/eval_string:74:3 {
  errno: -2,
  code: 'ENOENT',
  syscall: 'uv_cwd'
}

Node.js v22.14.0

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

Could be made clearer that this is a failure of process.cwd() as the stack trace makes no mention of it. One may make the connection by context, but not necessarily--it's non-obvious. If this was triggered by a process.cwd() deep in your code somewhere it could be quite confusing.

It'd also probably be useful to explain the possible scenario in which this could be triggered--the directory the process was working in was deleted somehow.

What do you see instead?

Error: ENOENT: no such file or directory, uv_cwd
    at process.wrappedCwd [as cwd] (node:internal/bootstrap/switches/does_own_process_state:142:28)
    at [eval]:1:9
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:449:12
    at [eval]-wrapper:6:24
    at runScriptInContext (node:internal/process/execution:447:60)
    at evalFunction (node:internal/process/execution:87:30)
    at evalScript (node:internal/process/execution:99:3)
    at node:internal/main/eval_string:74:3

Additional information

No response

@Qard Qard added good first issue Issues that are suitable for first-time contributors. confirmed-bug Issues with confirmed bugs. process Issues and PRs related to the process subsystem. labels Feb 14, 2025
@auxfix
Copy link

auxfix commented Feb 20, 2025

I'm going to take this as a "good first issue" if there are no objections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. good first issue Issues that are suitable for first-time contributors. process Issues and PRs related to the process subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants