-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Open
Labels
area:configurationRelates to configuration optionsRelates to configuration optionside:vscodeRelates specifically to VS Code extensionRelates specifically to VS Code extensionkind:bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavioros:windowsHappening specifically on WindowsHappening specifically on Windows
Description
Before submitting your bug report
- I've tried using the "Ask AI" feature on the Continue docs site to see if the docs have an answer
- I'm not able to find a related conversation on GitHub discussions that reports the same bug
- I'm not able to find an open issue that reports the same bug
- I've seen the troubleshooting guide on the Continue Docs
Relevant environment info
- OS: `Windows 11`
- Continue version: `v1.2.22`
- IDE version: `1.113.0`
- Model: `qwen2.5-coder-0.5b-instruct`
- config:
- name: Apply_qwen2.5-coder-0.5b-instruct
provider: lmstudio
model: qwen2.5-coder-0.5b-instruct
defaultCompletionOptions:
maxTokens: 31744 # 32256 error? # 31744 work # 32768 error? # 30720 work # 8192 work
roles:
- apply
apiBase: http://localhost:1234/v1/Description
Title
Continue extension fails or returns zero tokens when defaultCompletionOptions.maxTokens is set near 32k and suggestion
Environment
- VSCode:
1.113.0 - Continue extension:
v1.2.22 - OS:
Windows 11 - Model used:
qwen2.5-coder-0.5b-instruct(advertised Context Length: 32,768)
Reproduction steps
- Enable
Continue: Enable Consolein Continue → Settings, then check the Continue output channel and Developer Tools (Help → Toggle Developer Tools) for logs. - Add or modify
defaultCompletionOptionsinconfig.yamlwith a largemaxTokensvalue (examples below). - Trigger a Complete via Continue in VSCode.
Observed behavior
- When
maxTokensis set to 32768 (or 32767, 32256 in tests), Continue showsOptionscontaining the value but the result contains zero tokens:
Type: Complete
Result: Success
Prompt Tokens: 0
Generated Tokens: 0
ThinkingTokens: 0
Total Time: 2.04s
Options
{
"maxTokens": 32768,
"model": "qwen2.5-coder-0.5b-instruct",
"raw": true,
"reasoning": false
}- When
maxTokensis set to 30720, 31744 or 8192 the generation succeeds and tokens are produced: (If correct, it should be over 8000 tokens, because there were some issues after multiple apply and cancellation attempts.)
Type: Complete
Result: Success
Prompt Tokens: 1393
Generated Tokens: 1225
...
Options
{
"maxTokens": 30720,
"model": "qwen2.5-coder-0.5b-instruct",
"raw": true,
"reasoning": false
}- Without
defaultCompletionOptionsset, defaultmaxTokens = 4096. For prompts longer than 4096 tokens the generation is truncated/stopped and the extension does not notify the user. - With
defaultCompletionOptionsset to large values, some values succeed (e.g., 30720, 31744) while values near 32768 fail silently (e.g., 32256, 32767, 32768) producing Result: Success but Prompt Tokens: 0 and Generated Tokens: 0. - This indicates both: (a) the extension/backend enforces a different effective maximum than the model advertises, and (b) the extension does not surface clear validation errors to the user.
Listener leak observed
- While reproducing apply, Developer Tools shows warnings like:
[042] potential listener LEAK detected, having 571 listeners already. MOST frequent listener (172): Error
Error
ERR potential listener LEAK detected, dominated: Error
- This appears each time apply is triggered and the number of listeners grows. Observed consequences include memory growth and silent failures (zero-token results).
- I can attach the full Developer Tools Console stack trace and Network trace if helpful.
Prompt content incorrect after repeated apply
- Initially, apply shows correct Prompt content containing both original code and suggested code. After repeated tests or when listener warnings appear, the Continue Console shows incorrect or empty Prompt content that does not include the original code and suggested code. (Or only partial content[code])
- Reproduction pattern:
- Trigger apply several times.
- Early runs show correct Prompt content.
- Later runs show Prompt missing or replaced with incorrect content and generation returns zero tokens.
- Likely causes: race condition in prompt assembly, shared mutable state being overwritten, or multiple event handlers modifying/clearing the prompt before send.
Additional observations and test matrix
- Values that work in my tests:
8192,30720,31744. - Values that fail or produce zero-token result:
32256,32767,32768. - Hypothesis: there may be an internal buffer or effective maximum (e.g., 32,768 − 1024 = 31,744), a schema/validation boundary, or integer/edge-case handling near 32k. The listener leak suggests repeated registration per apply invocation causing resource exhaustion or short-circuit.
Suggested debug checks for maintainers
- Check
contributes.configurationschema or any validation logic formaxTokens— is there amaximumset? - Verify whether the extension or backend reserves a token buffer (e.g., 1024) and whether that effective maximum is documented or enforced at config load time.
- Inspect integer handling and serialization for
maxTokensto rule out overflow/edge-case bugs. - Investigate repeated event listener registration during apply; check for missing
dispose/removeListeneror missingcontext.subscriptionsusage. - Add debug logs that print the prompt immediately before sending the request and verify the network payload.
- Ensure that when a config value is invalid or rejected, the extension returns a clear error message (in Output/Console and as a VSCode notification) rather than silent success.
- Provide the actual effective maximum in Settings UI or validate
config.yamlon load with a clear message indicating allowed range.
Logs to attach
- Continue Output channel logs (snippets above).
- Developer Tools Console and Network traces captured while reproducing the issue (request payloads, backend responses, and listener leak stack trace).
config.yamlsnippet used (remove any sensitive keys).
Suggested fix / UX improvements
- Validate
defaultCompletionOptionson load and show a clear VSCode notification if values are out of range. - When a request is rejected or short-circuited, log a descriptive error in the extension Output channel and Developer Tools console.
- Fix repeated listener registration and ensure proper disposal of event handlers.
- Ensure prompt assembly uses a local immutable snapshot of editor content before any async operations.
- Document the effective maximum
maxTokensfor each supported model or any backend buffer that reduces the usable limit from the model's advertised context length.
Minimal reproduction checklist for maintainers
- Reproduce with the provided
config.yamlsnippet and theqwen2.5-coder-0.5b-instructmodel. - Compare behavior for
maxTokensvalues:30720,31744,32256,32767,32768. - Capture the exact request payload sent by the extension and the backend response.
- Capture Developer Tools Console stack trace showing the listener leak.
Labels suggested
- bug, needs-triage, extension
My English isn't perfect; some content was AI-assisted.
To reproduce
Reproduction steps
- Enable
Continue: Enable Consolein Continue → Settings, then check the Continue output channel and Developer Tools (Help → Toggle Developer Tools) for logs. - Add or modify
defaultCompletionOptionsinconfig.yamlwith a largemaxTokensvalue. - Trigger a Complete (Apply) via Continue in VSCode.
- (repeat, setting difference
defaultCompletionOptionsinconfig.yamland try again).
Log output
I can't find `/core.log`.
In the initial test, the result was cancelled, but in subsequent tests, the result was successful, except for tests 32256, 32767, and 32768, which either failed or produced a zero-token.(A zero-token indicates a successful result.)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:configurationRelates to configuration optionsRelates to configuration optionside:vscodeRelates specifically to VS Code extensionRelates specifically to VS Code extensionkind:bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavioros:windowsHappening specifically on WindowsHappening specifically on Windows
Type
Projects
Status
Todo