You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Error] unhandlederror-Cannot change enablement of GitHub Copilot Chat extension because of its extension ki... #312381
Error: Cannot change enablement of GitHub Copilot Chat extension because of its extension kind at Ret.throwErrorIfEnablementStateCannotBeChanged (out/vs/workbench/workbench.desktop.main.js:1813:19298) at Ret.throwErrorIfCannotChangeEnablement (out/vs/workbench/workbench.desktop.main.js:1813:18916) at Ret.setEnablement (out/vs/workbench/workbench.desktop.main.js:1813:20214) at async n6.doSetEnablement (out/vs/workbench/workbench.desktop.main.js:3402:55631) at async Jfe.maybeEnableOrDisableExtension (out/vs/workbench/workbench.desktop.main.js:3625:48214)
ChatTeardownContribution.maybeEnableOrDisableExtension() calls extensionsWorkbenchService.setEnablement() without checking whether the extension's current enablement state permits changes. When the Copilot Chat extension is in DisabledByExtensionKind state — which occurs in remote contexts (SSH, WSL, Dev Containers, tunnels) where the extension's kind doesn't match its install location — setEnablement() throws an unhandled error. With 25,773 hits from 7,808 users on stable 1.117.0, this is a high-impact regression affecting all remote users who have chat.disableAIFeatures enabled.
Culprit Commit
No single commit range was available from regression scan comments. The root cause is a missing guard in maybeEnableOrDisableExtension() that has existed since the method was introduced, but the conditions to trigger it became widespread with the following PRs in the 1.116.0–1.117.0 timeframe:
Introduced migration that auto-sets chat.disableAIFeatures to true for users who previously had the extension disabled — greatly increasing the number of users exercising the handleChatDisabled code path
Fixed workspace-level enablement handling in ChatTeardownContribution
The error first appeared in 1.117.0 insiders (commit 173f07e5, April 20) and not in 1.116.0, suggesting a change in 1.117.0 (possibly PR #310840 or a change in the extension's kind/install behavior) created the final conditions for the crash.
Code Flow
sequenceDiagram
participant Config as ConfigurationService
participant Teardown as ChatTeardownContribution
participant ExtWB as ExtensionsWorkbenchService
participant Enable as ExtensionEnablementService
Note over Teardown: Constructor or config change
Teardown->>Teardown: handleChatDisabled()
Note over Teardown: chat.disableAIFeatures === true
Teardown->>ExtWB: setEnablement([copilotChat], DisabledGlobally)
ExtWB->>Enable: setEnablement(extensions, DisabledGlobally)
Enable->>Enable: throwErrorIfCannotChangeEnablement()
Enable->>Enable: getEnablementState() → DisabledByExtensionKind
Note over Enable: ⚠️ Root cause: no guard<br/>for non-changeable states
Enable->>Enable: throwErrorIfEnablementStateCannotBeChanged()
Note over Enable: 💥 Error thrown:<br/>"Cannot change enablement of<br/>GitHub Copilot Chat extension<br/>because of its extension kind"
Data flow — doSetEnablement() (line 3138) passes through to enablement service
Repro Steps
Open VS Code on desktop with a remote connection (SSH, WSL, or Dev Container)
The Copilot Chat extension must be installed in a location that mismatches its extensionKind (e.g., installed remotely but has UI kind) — this causes DisabledByExtensionKind
Approach: Before calling this.extensionsWorkbenchService.setEnablement(), check the extension's current enablement state. If the state is one of the non-changeable states (DisabledByExtensionKind, DisabledByEnvironment, DisabledByMalicious, DisabledByVirtualWorkspace, DisabledByAllowlist, DisabledByInvalidExtension), bail out early without calling setEnablement. Alternatively, wrap the setEnablement call in a try/catch to gracefully handle the error. The former approach is preferred as it avoids unnecessary work and makes the intent explicit:
if extension is found:
check currentState = extension.enablementState
if currentState is one of [DisabledByExtensionKind, DisabledByEnvironment, ...]:
return (cannot change this extension's enablement)
proceed with setEnablement(...)
Note: The getExtensionsToEnableRecursively() method in extensionEnablementService.ts (line 335) already has a similar guard that skips DisabledByExtensionKind for dependencies — the same pattern should be applied in maybeEnableOrDisableExtension.
Recommended Owner
@sandy081 — Author of all related PRs (#308478, #308988, #310840) and the extension enablement area expert. All three PRs that built the chat.disableAIFeatures ↔ extension enablement integration were authored by this developer.
Insider regression scan — Bucket cca85117 linked (1.118.0-insider, build f2b51f3f). This is the same logical error as bucket 430d5b15 tracked in the stable scan — the bucket ID changed due to minification drift between builds. 21 users affected in the latest insider build.
Connect to WSL (install extension, wait for it to finish connecting)
Set "chat.disableAIFeatures": true in user settings
Open dev tools -> console
Reload window
Actual
Error in console:
ERR Cannot change enablement of GitHub Copilot Chat extension because of its extension kind: Error: Cannot change enablement of GitHub Copilot Chat extension because of its extension kind
at $tt.throwErrorIfEnablementStateCannotBeChanged (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:19861)
at $tt.throwErrorIfCannotChangeEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:19479)
at $tt.setEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:20777)
at async o9.doSetEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:3650:55631)
at async Nve.maybeEnableOrDisableExtension (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:3304:48432)
Activity
vs-code-engineering commentedon Apr 24, 2026
vs-code-engineering commentedon Apr 24, 2026
🔍 Error Investigation
Summary
ChatTeardownContribution.maybeEnableOrDisableExtension()callsextensionsWorkbenchService.setEnablement()without checking whether the extension's current enablement state permits changes. When the Copilot Chat extension is inDisabledByExtensionKindstate — which occurs in remote contexts (SSH, WSL, Dev Containers, tunnels) where the extension's kind doesn't match its install location —setEnablement()throws an unhandled error. With 25,773 hits from 7,808 users on stable 1.117.0, this is a high-impact regression affecting all remote users who havechat.disableAIFeaturesenabled.Culprit Commit
No single commit range was available from regression scan comments. The root cause is a missing guard in
maybeEnableOrDisableExtension()that has existed since the method was introduced, but the conditions to trigger it became widespread with the following PRs in the 1.116.0–1.117.0 timeframe:@sandy081chat.disableAIFeaturestotruefor users who previously had the extension disabled — greatly increasing the number of users exercising thehandleChatDisabledcode path@sandy081@sandy081ChatTeardownContributionThe error first appeared in 1.117.0 insiders (commit
173f07e5, April 20) and not in 1.116.0, suggesting a change in 1.117.0 (possibly PR #310840 or a change in the extension's kind/install behavior) created the final conditions for the crash.Code Flow
sequenceDiagram participant Config as ConfigurationService participant Teardown as ChatTeardownContribution participant ExtWB as ExtensionsWorkbenchService participant Enable as ExtensionEnablementService Note over Teardown: Constructor or config change Teardown->>Teardown: handleChatDisabled() Note over Teardown: chat.disableAIFeatures === true Teardown->>ExtWB: setEnablement([copilotChat], DisabledGlobally) ExtWB->>Enable: setEnablement(extensions, DisabledGlobally) Enable->>Enable: throwErrorIfCannotChangeEnablement() Enable->>Enable: getEnablementState() → DisabledByExtensionKind Note over Enable: ⚠️ Root cause: no guard<br/>for non-changeable states Enable->>Enable: throwErrorIfEnablementStateCannotBeChanged() Note over Enable: 💥 Error thrown:<br/>"Cannot change enablement of<br/>GitHub Copilot Chat extension<br/>because of its extension kind"Affected Files
src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.tsmaybeEnableOrDisableExtension()(line 778) callssetEnablementwithout checking current statesrc/vs/workbench/services/extensionManagement/browser/extensionEnablementService.tsthrowErrorIfEnablementStateCannotBeChanged()(line 242) throws forDisabledByExtensionKindsrc/vs/workbench/contrib/extensions/browser/extensionsWorkbenchService.tsdoSetEnablement()(line 3138) passes through to enablement serviceRepro Steps
extensionKind(e.g., installed remotely but has UI kind) — this causesDisabledByExtensionKind"chat.disableAIFeatures": truein user settings (or have it auto-set by the migration from PR disable copilot chat extension by default and adopt accordingly #308478)ChatTeardownContributionconstructor callshandleChatDisabled(false), which attempts to disable the extension viasetEnablement, which throwsFix Proposal
Fix location:
src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.ts→maybeEnableOrDisableExtension()Approach: Before calling
this.extensionsWorkbenchService.setEnablement(), check the extension's current enablement state. If the state is one of the non-changeable states (DisabledByExtensionKind,DisabledByEnvironment,DisabledByMalicious,DisabledByVirtualWorkspace,DisabledByAllowlist,DisabledByInvalidExtension), bail out early without callingsetEnablement. Alternatively, wrap thesetEnablementcall in a try/catch to gracefully handle the error. The former approach is preferred as it avoids unnecessary work and makes the intent explicit:Note: The
getExtensionsToEnableRecursively()method inextensionEnablementService.ts(line 335) already has a similar guard that skipsDisabledByExtensionKindfor dependencies — the same pattern should be applied inmaybeEnableOrDisableExtension.Recommended Owner
@sandy081— Author of all related PRs (#308478, #308988, #310840) and the extension enablement area expert. All three PRs that built thechat.disableAIFeatures↔ extension enablement integration were authored by this developer.vs-code-engineering commentedon Apr 27, 2026
Insider regression scan — Bucket
cca85117linked (1.118.0-insider, buildf2b51f3f). This is the same logical error as bucket430d5b15tracked in the stable scan — the bucket ID changed due to minification drift between builds. 21 users affected in the latest insider build.vs-code-engineering commentedon Apr 27, 2026
vs-code-engineering commentedon May 7, 2026
Stable Release Anomaly Details
These additional error buckets are tracked by this issue (v1.119.0):
09a336c4The error continues to appear in the latest stable release with a new bucket ID (due to minification changes).
dmitrivMS commentedon May 9, 2026
Repro Steps
"chat.disableAIFeatures": truein user settingsActual
Error in console:
ERR Cannot change enablement of GitHub Copilot Chat extension because of its extension kind: Error: Cannot change enablement of GitHub Copilot Chat extension because of its extension kind
at $tt.throwErrorIfEnablementStateCannotBeChanged (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:19861)
at $tt.throwErrorIfCannotChangeEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:19479)
at $tt.setEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:1827:20777)
at async o9.doSetEnablement (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:3650:55631)
at async Nve.maybeEnableOrDisableExtension (vscode-file://vscode-app/c:/Users/dmitriv/AppData/Local/Programs/Microsoft%20VS%20Code%20Insiders/3b8129f1d0/resources/app/out/vs/workbench/workbench.desktop.main.js:3304:48432)
Expected
No error.
Skip chat extension enablement change when locked by environment (#31…