ReferenceError: Cannot access 'ONNX_NODE' before initialization on Amazon Q startup
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
When starting Amazon Q in VS Code, the extension crashes with a `ReferenceError`:
```
ReferenceError: Cannot access 'ONNX_NODE' before initialization
at C:\Users\User\AppData\Local\aws\toolkits\language-servers\AmazonQ\1.3.0\servers\indexing\dist\extension.js:450:24429
```
This appears to be due to an uninitialized or incorrectly ordered import or variable declaration involving `ONNX_NODE`.
## Steps to reproduce the issue
1. Install Amazon Q in VS Code
2. Start the extension (e.g., let it load on startup)
3. Wait for it to attempt to initialize the ONNX session
4. Observe the crash in the logs and "Server will not be restarted" message
## Expected behavior
Amazon Q should initialize and load models successfully without throwing a ReferenceError or crashing the language server.
## System details
- **OS:** Windows 11 (x64)
- **Visual Studio Code version:** Run `code -v` in PowerShell:
```
1.100.2
848b80aeb52026648a8ff9f7c45a9b0a80641e2e
x64
```
- **AWS Toolkit version:** Run `AWS: About` in VS Code:
```
3.63.0
```
- **Amazon Q version:** 1.3.0
- **Node.js version:** 22.14.0 (system), but the extension appears to attempt to use v18.20.8 internally
- **Extension install path:** `C:\Users\User\AppData\Local\aws\toolkits\language-servers\AmazonQ\1.3.0`
Contributor guide
Research direction
Reproduce Amazon Q startup on Windows 11 with the listed VS Code, AWS Toolkit, and Amazon Q versions, then inspect the reported extension.js location at line 450:24429 and the startup logs. Trace the ONNX_NODE initialization failure and verify that the extension loads models without the ReferenceError or language-server crash.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100