aws-toolkit-vscode icon indicating copy to clipboard operation
aws-toolkit-vscode copied to clipboard

Q Extension fails to load with error 'amazonqLsp: failed to run (exitcode=1)'

Open teknologika opened this issue 6 months ago • 1 comments

Problem

Amazon Q VScode plugin fails to load with the following error after the latest updates.

2025-06-17 15:14:47.390 [info] lsp: Installing 'AmazonQ' Language Server v1.13.0 to: /Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0 (Attribution notice can be found at https://aws-language-servers.us-east-1.amazonaws.com/65ebf30c-d9e8-4477-b027-c60f62250433/THIRD_PARTY_LICENSES)
2025-06-17 15:14:48.955 [info] lsp: Finished preparing "AmazonQ" LSP server: '/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0'
2025-06-17 15:14:50.543 [warning] telemetry: invalid Metric:  "languageServer_setup" emitted with missing fields: id
2025-06-17 15:14:50.543 [warning] amazonqLsp: Failed to start downloaded LSP, falling back to bundled LSP: amazonqLsp: failed to run (exitcode=1): PID 2591: [/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/node /Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js --nolazy --preserve-symlinks --stdio --pre-init-encryption --set-credentials-encryption-key]
2025-06-17 15:14:50.833 [warning] childProcess: Process 2595 exceeded memory threshold: 157.89 MB
2025-06-17 15:14:51.021 [info] initialized 'submitFeedback' command with default feedback id: Amazon Q

Steps to reproduce the issue

  1. Install plugin
  2. Plugin fails to launch and Shows error 'Failed to Launch Amazon Q language server failed to run.

Expected behaviour

Plugin loads and runs.

Reverting to version 1.61 resolves this issue, all versions beyond that fail with the same error.

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

  • OS: Mac OS X 15.5
  • Visual Studio Code version: 1.101.0
  • AWS Toolkit version:
  • Amazon Q version: 1.75.0

teknologika avatar Jun 17 '25 05:06 teknologika

What happens if you run this in your terminal:

/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/node /Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js --nolazy --preserve-symlinks --stdio --pre-init-encryption --set-credentials-encryption-key

justinmk3 avatar Jun 17 '25 18:06 justinmk3

The following error occurs ( account number and username redacted )

TypeError: Cannot redefine property: AWSPowerUserAccess-111111111111
    at Function.defineProperty (<anonymous>)
    at /Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1902277
    at Array.forEach (<anonymous>)
    at a (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1902223)
    at constructor.loadFrom (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1902909)
    at u (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1807727)
    at constructor.region (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1808700)
    at constructor.set (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1725502)
    at constructor.<anonymous> (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1723632)
    at constructor.each (/Users/redacted/Library/Caches/aws/toolkits/language-servers/AmazonQ/1.13.0/servers/aws-lsp-codewhisperer.js:8:1930021)


Node.js v18.20.8

teknologika avatar Jun 17 '25 23:06 teknologika

I can confirm this issue still exists with version v1.79.0

teknologika avatar Jun 25 '25 23:06 teknologika

Issue https://github.com/aws/aws-toolkit-vscode/issues/7538 appears to the same as this issue.

teknologika avatar Jun 25 '25 23:06 teknologika

Issue has been identified and sorted.

Problem: The Amazon Q language server was failing with a "Cannot redefine property" error for an AWS profile.

Root Cause:

The AWS config file had duplicate profile definitions for the same profile: • [profile-name] (incorrect format) • [profile profile-name] (correct format)

Solution Applied:

  1. Backed up the original config to ~/.aws/config.backup
  2. Removed the duplicate entry - kept only the properly formatted [profile profile-name] section
  3. Cleared caches - removed AWS CLI and Amazon Q language server cached data
  4. Refreshed SSO login - ran aws sso login --profile

Result: The duplicate profile conflict was eliminated, allowing the language server to start without the property redefinition error.

teknologika avatar Jun 27 '25 01:06 teknologika

@teknologika Can you describe more detail about the solution please? I tried to fix but it didnt work

minhnghia2k3 avatar Jul 02 '25 04:07 minhnghia2k3