Skip to content

uv_os_get_passwd returned ENOENT if user uses AD (ldap or similar) #5277

@memorsolutions

Description

@memorsolutions

Problem

Both the AWS Toolkit and Amazon Q extensions produce the following error when the extension is activated and the effective user account is one that is defined externally (e.g., AD, LDAP).
[error] SystemError: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)

This appears to have been introduced by #5215 with the addition of the call to os.userInfo in getUsername (env.ts).

In such cases, the effective user ID does not have a matching entry in /etc/passwd and userInfo throw an exception. This error is discussed in several issues in other repos such as:

Might a fallback to process.env.USER be an acceptable approach for these extensions?

NOTE: Recent restructuring in c21dce1 appears to retain this bug.

Steps to reproduce the issue

  1. Login as a user that is synced to AD/LDAP.
  2. Install AWS Toolkit and Amazon Q
  3. See errors in ~/.config/Code/logs/<date and time>/window1/exthost/exthost.log
2024-07-08 12:09:53.596 [info] ExtensionService#_doActivateExtension amazonwebservices.amazon-q-vscode, startup: false, activationEvent: 'onStartupFinished'
2024-07-08 12:09:54.179 [error] Activating extension amazonwebservices.amazon-q-vscode failed due to an error:
2024-07-08 12:09:54.179 [error] SystemError: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
        at new SystemError (node:internal/errors:257:5)
        at new NodeError (node:internal/errors:368:7)
        at Object.userInfo (node:os:365:11)
        at B (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.amazon-q-vscode-1.11.0/dist/src/extension.js:6527:34920)
        at h (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.amazon-q-vscode-1.11.0/dist/src/extension.js:6464:1883)
        at N.stop (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.amazon-q-vscode-1.11.0/dist/src/extension.js:6505:14214)
        at /home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.amazon-q-vscode-1.11.0/dist/src/extension.js:6505:15066
        at async p (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.amazon-q-vscode-1.11.0/dist/src/extension.js:6612:10284098)
        at async T (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.amazon-q-vscode-1.11.0/dist/src/extension.js:6612:10284957)
        at async c.n (/snap/code/163/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:6384)
        at async c.m (/snap/code/163/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:6347)
        at async c.l (/snap/code/163/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:5804)
2024-07-08 15:05:21.445 [info] ExtensionService#_doActivateExtension amazonwebservices.aws-toolkit-vscode, startup: false, activationEvent: 'onStartupFinished'
2024-07-08 15:05:23.110 [error] Activating extension amazonwebservices.aws-toolkit-vscode failed due to an error:
2024-07-08 15:05:23.111 [error] SystemError: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
        at new SystemError (node:internal/errors:257:5)
        at new NodeError (node:internal/errors:368:7)
        at Object.userInfo (node:os:365:11)
        at Ce (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:2140:35771)
        at P (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:2060:1913)
        at I.stop (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:2117:14321)
        at /home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:2117:15179
        at async He (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:1969:6283)
        at async Ht (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:1963:41327)
        at async N (/home/jcarswell@GatorFam5.local/.vscode/extensions/amazonwebservices.aws-toolkit-vscode-3.12.0/dist/src/extension.js:2227:9941405)
        at async c.n (/snap/code/163/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:6384)
        at async c.m (/snap/code/163/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:6347)
        at async c.l (/snap/code/163/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:144:5804)

Expected behavior

Extensions load without error.

System details (run AWS: About and/or Amazon Q: About)

  • OS: Ubuntu 22.04.4 (but I suspect others).
  • Visual Studio Code version: 1.91.0
  • AWS Toolkit version: 3.12.0
  • Amazon Q version: 1.11.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugWe can reproduce the issue and confirmed it is a bug.pending-release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions