coder/code-server · critical · Error

Missing web configuration element

Error message

Missing web configuration element

What it means

This error originates in VS Code's workbench startup (the base-path.diff patch touches the surrounding config-reading code). It is thrown when the workbench cannot find the DOM element and attribute that carry the JSON IWorkbenchConstructionOptions injected by code-server into the served HTML. Without that element the browser workbench cannot bootstrap, so it aborts immediately.

Source

Thrown at patches/base-path.diff:286

 }
 
-function readCookie(name: string): string | undefined {
-	const cookies = document.cookie.split('; ');
-	for (const cookie of cookies) {
-		if (cookie.startsWith(name + '=')) {
-			return cookie.substring(name.length + 1);
-		}
-	}
-
-	return undefined;
-}
-
 (function () {
 
 	// Find config by checking for DOM
@@ -610,8 +600,8 @@ function readCookie(name: string): strin
 	if (!configElement || !configElementAttribute) {
 		throw new Error('Missing web configuration element');
 	}
-	const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = JSON.parse(configElementAttribute);
-	const secretStorageKeyPath = readCookie('vscode-secret-key-path');
+	const config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = { ...JSON.parse(configElementAttribute), remoteAuthority: location.host }
+	const secretStorageKeyPath = (window.location.pathname + "/mint-key").replace(/\/\/+/g, "/");
 	const secretStorageCrypto = secretStorageKeyPath && ServerKeyedAESCrypto.supported()
 		? new ServerKeyedAESCrypto(secretStorageKeyPath) : new TransparentCrypto();
 
Index: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
===================================================================
--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
+++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts
@@ -120,7 +120,7 @@ export abstract class AbstractExtensionR
 					: version,
 				path: 'extension'
 			}));
-			return this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;
+			return this._isWebExtensionResourceEndPoint(uri) ? URI.joinPath(URI.parse(window.location.href), uri.path) : uri;

View on GitHub (pinned to 51f90a376b)

Solutions

  1. Ensure code-server's HTML template (the page that injects the config element and attribute) is the one being served — clear cache / rebuild.
  2. Re-apply the patches against the matching VS Code version: the base-path.diff context lines must align.
  3. Verify the DOM contains the expected element (e.g. the script/element holding data-settings) before the workbench bootstraps.
  4. Check the network response for the workbench HTML to confirm the injected config attribute is present.

Example fix

// In the served HTML, ensure the config element exists:
// <div id="vscode-remote-bootstrap" data-settings="{...escaped JSON...}"></div>
// If a patch removed it, restore the element injection in the code-server template.
Defensive patterns

Strategy: validation

Validate before calling

// Server-side: confirm the config element attribute is set before serving workbench HTML.
function assertConfigInjected(html: string) {
  if (!/data-settings=/.test(html)) throw new Error('Config element not injected')
  return html
}

Type guard

// In the browser bootstrap
function hasConfigElement(doc: Document): boolean {
  const el = document.getElementById('vscode-remote-bootstrap')
  return !!el && !!el.getAttribute('data-settings')
}

Try / catch

try {
  bootstrap()
} catch (e) {
  if (/Missing web configuration element/.test(e.message)) {
    location.reload(true) // retry once after cache-bust
  }
}

Prevention

When it happens

Trigger: Loading the workbench HTML before code-server has injected the config element/attribute; a custom HTML template that omits the config element; a patch (like base-path.diff) applied incorrectly that breaks the element lookup; a CDN/cached HTML shell that does not contain the injected configuration.

Common situations: Applying the base-path patch on an incompatible VS Code version so the element selector no longer matches; serving a stale/cached workbench.html; a build step that strips the injection target element; running against a fork whose config attribute has a different name.

Related errors


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