{"record":{"id":"a6fdfbf214156220","repo":"coder/code-server","slug":"isenabledfiledownloads-was-not-provided-to-the-bro","errorCode":null,"errorMessage":"isEnabledFileDownloads was not provided to the browser","messagePattern":"isEnabledFileDownloads was not provided to the browser","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"patches/external-file-actions.diff","lineNumber":74,"sourceCode":"+\t */\n+\treadonly isEnabledFileDownloads?: boolean;\n+\n+\t/**\n+\t * Enable uploading files via menu actions.\n+\t */\n+\treadonly isEnabledFileUploads?: boolean;\n+\n+\t/**\n \t * Gets whether a resolver extension is expected for the environment.\n \t */\n \treadonly expectsResolverExtension: boolean;\n@@ -111,6 +121,20 @@ export class BrowserWorkbenchEnvironment\n \t\treturn this.options.userDataPath;\n \t}\n \n+\tget isEnabledFileDownloads(): boolean {\n+\t\tif (typeof this.options.isEnabledFileDownloads === \"undefined\") {\n+\t\t\tthrow new Error('isEnabledFileDownloads was not provided to the browser');\n+\t\t}\n+\t\treturn this.options.isEnabledFileDownloads;\n+\t}\n+\n+\tget isEnabledFileUploads(): boolean {\n+\t\tif (typeof this.options.isEnabledFileUploads === \"undefined\") {\n+\t\t\tthrow new Error('isEnabledFileUploads was not provided to the browser');\n+\t\t}\n+\t\treturn this.options.isEnabledFileUploads;\n+\t}\n+\n \t@memoize\n \tget argvResource(): URI { return joinPath(this.userRoamingDataHome, 'argv.json'); }\n \nIndex: code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts\n===================================================================\n--- code-server.orig/lib/vscode/src/vs/server/node/serverEnvironmentService.ts\n+++ code-server/lib/vscode/src/vs/server/node/serverEnvironmentService.ts","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/coder/code-server/blob/51f90a376b42e217b38937410fe2855e0c1db87e/patches/external-file-actions.diff#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// code-server option injection (server side)\n// before: options = { ...config }\n// after\noptions = { ...config, isEnabledFileDownloads: true, isEnabledFileUploads: true }","handlingStrategy":"validation","validationCode":"// Server-side: ensure the flag is always set in construction options.\noptions.isEnabledFileDownloads = options.isEnabledFileDownloads ?? true","typeGuard":"function optionsHasFileDownloads(o: Record<string, unknown>): boolean {\n  return typeof o.isEnabledFileDownloads === 'boolean'\n}","tryCatchPattern":"try {\n  return environmentService.isEnabledFileDownloads\n} catch (e) {\n  if (/isEnabledFileDownloads was not provided/.test(e.message)) return true // safe default\n}","preventionTips":["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."],"tags":["workbench","patch","environment-service","file-actions","config"],"backgroundTag":null,"analyzedSha":"51f90a376b42e217b38937410fe2855e0c1db87e","analyzedAt":"2026-08-12T11:27:34.273Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}