coder/code-server · error · Error

isEnabledFileUploads was not provided to the browser

Error message

isEnabledFileUploads was not provided to the browser

What it means

Thrown by the isEnabledFileUploads getter added by the external-file-actions.diff patch to BrowserWorkbenchEnvironmentImpl when this.options.isEnabledFileUploads is undefined. It mirrors the downloads guard: any workbench code (e.g. the upload command) that reads the getter before the option is injected will throw.

Source

Thrown at patches/external-file-actions.diff:81

+
+	/**
 	 * 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.ts
@@ -19,6 +19,8 @@ export const serverOptions: OptionDescri
 	/* ----- code-server ----- */
 	'disable-update-check': { type: 'boolean' },
 	'auth': { type: 'string' },
+	'disable-file-downloads': { type: 'boolean' },
+	'disable-file-uploads': { type: 'boolean' },
 

View on GitHub (pinned to 51f90a376b)

Solutions

  1. Wire isEnabledFileUploads into the workbench construction options on the code-server side.
  2. Apply the complete external-file-actions.diff (getter + serverEnvironmentService option registration).
  3. Rebuild so the option is serialized into the browser config element.
  4. Delay extension/workbench reads of the getter until after options are parsed.

Example fix

// before
options.isEnabledFileDownloads = true
// after
options.isEnabledFileDownloads = true
options.isEnabledFileUploads = true
Defensive patterns

Strategy: validation

Validate before calling

options.isEnabledFileUploads = options.isEnabledFileUploads ?? true

Type guard

function optionsHasFileUploads(o: Record<string, unknown>): boolean {
  return typeof o.isEnabledFileUploads === 'boolean'
}

Try / catch

try {
  return environmentService.isEnabledFileUploads
} catch (e) {
  if (/isEnabledFileUploads was not provided/.test(e.message)) return true
}

Prevention

When it happens

Trigger: A workbench or extension code path evaluates environmentService.isEnabledFileUploads before code-server has supplied the option in the construction options; the patch added the getter but the matching server-side option wiring (serverEnvironmentService.ts hunk) was not applied.

Common situations: Partial patch application; version drift between the patch and the VS Code tree; a custom build that strips the upload option injection; an extension eagerly reading the flag at activation.

Related errors


AI-assisted analysis of coder/code-server@51f90a376b (2026-08-12). Data as JSON: /api/errors/91ad038722e02d1d. Report an issue: GitHub.