coder/code-server · error · Error
isEnabledFileDownloads was not provided to the browser
Error message
isEnabledFileDownloads was not provided to the browser
What it means
Thrown by the isEnabledFileDownloads getter added to BrowserWorkbenchEnvironmentImpl by the external-file-actions.diff patch. The getter throws if this.options.isEnabledFileDownloads is undefined — i.e. code-server did not pass the flag into the workbench construction options. Any workbench feature that reads the getter (e.g. the file-download command) will surface this error.
Source
Thrown at patches/external-file-actions.diff:74
+ */
+ readonly isEnabledFileDownloads?: boolean;
+
+ /**
+ * Enable uploading files via menu actions.
+ */
+ readonly isEnabledFileUploads?: boolean;
+
+ /**
* Gets whether a resolver extension is expected for the environment.
*/
readonly expectsResolverExtension: boolean;
@@ -111,6 +121,20 @@ export class BrowserWorkbenchEnvironment
return this.options.userDataPath;
}
+ get isEnabledFileDownloads(): boolean {
+ if (typeof this.options.isEnabledFileDownloads === "undefined") {
+ throw new Error('isEnabledFileDownloads was not provided to the browser');
+ }
+ return this.options.isEnabledFileDownloads;
+ }
+
+ get isEnabledFileUploads(): boolean {
+ if (typeof this.options.isEnabledFileUploads === "undefined") {
+ throw new Error('isEnabledFileUploads was not provided to the browser');
+ }
+ return this.options.isEnabledFileUploads;
+ }
+
@memoize
get argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); }
Index: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts
+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.tsView on GitHub (pinned to 51f90a376b)
Solutions
- Ensure the code-server build injects isEnabledFileDownloads (and isEnabledFileUploads) into the workbench construction options payload.
- Apply the full external-file-actions.diff, including any serverEnvironmentService.ts hunks that register the option.
- If you intentionally disabled file actions, remove code paths that read the getter instead of leaving the option undefined.
- Rebuild the workbench after patching so the new option flows from server to browser.
Example fix
// code-server option injection (server side)
// before: options = { ...config }
// after
options = { ...config, isEnabledFileDownloads: true, isEnabledFileUploads: true } Defensive patterns
Strategy: validation
Validate before calling
// Server-side: ensure the flag is always set in construction options. options.isEnabledFileDownloads = options.isEnabledFileDownloads ?? true
Type guard
function optionsHasFileDownloads(o: Record<string, unknown>): boolean {
return typeof o.isEnabledFileDownloads === 'boolean'
} Try / catch
try {
return environmentService.isEnabledFileDownloads
} catch (e) {
if (/isEnabledFileDownloads was not provided/.test(e.message)) return true // safe default
} Prevention
- Inject every boolean flag the workbench expects into the construction options.
- Apply patches as complete sets (getter + option registration).
- Rebuild after patching.
- Add a startup self-test that asserts all required options are present.
When it happens
Trigger: The workbench construction options object built by code-server does not include isEnabledFileDownloads, but an extension or workbench component evaluates environmentService.isEnabledFileDownloads. This happens when the patch that adds the getter is applied but the server-side option injection is missing or out of sync.
Common situations: Partial patch application (getter added, but the option not wired into the options bag sent to the browser); upgrading VS Code/code-server where the option name changed; a fork that disables file actions but still references the getter.
Related errors
- isEnabledFileUploads was not provided to the browser
- isEnabledCoderGettingStarted was not provided to the browser
- userDataPath was not provided to the browser
- Missing web configuration element
- invalid config: ${config}
AI-assisted analysis of coder/code-server@51f90a376b (2026-08-12).
Data as JSON: /api/errors/a6fdfbf214156220.
Report an issue: GitHub.