{"record":{"id":"a6493ed17a8f68ad","repo":"coder/code-server","slug":"missing-web-configuration-element","errorCode":null,"errorMessage":"Missing web configuration element","messagePattern":"Missing web configuration element","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"patches/base-path.diff","lineNumber":286,"sourceCode":" }\n \n-function readCookie(name: string): string | undefined {\n-\tconst cookies = document.cookie.split('; ');\n-\tfor (const cookie of cookies) {\n-\t\tif (cookie.startsWith(name + '=')) {\n-\t\t\treturn cookie.substring(name.length + 1);\n-\t\t}\n-\t}\n-\n-\treturn undefined;\n-}\n-\n (function () {\n \n \t// Find config by checking for DOM\n@@ -610,8 +600,8 @@ function readCookie(name: string): strin\n \tif (!configElement || !configElementAttribute) {\n \t\tthrow new Error('Missing web configuration element');\n \t}\n-\tconst config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = JSON.parse(configElementAttribute);\n-\tconst secretStorageKeyPath = readCookie('vscode-secret-key-path');\n+\tconst config: IWorkbenchConstructionOptions & { folderUri?: UriComponents; workspaceUri?: UriComponents; callbackRoute: string } = { ...JSON.parse(configElementAttribute), remoteAuthority: location.host }\n+\tconst secretStorageKeyPath = (window.location.pathname + \"/mint-key\").replace(/\\/\\/+/g, \"/\");\n \tconst secretStorageCrypto = secretStorageKeyPath && ServerKeyedAESCrypto.supported()\n \t\t? new ServerKeyedAESCrypto(secretStorageKeyPath) : new TransparentCrypto();\n \nIndex: code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts\n===================================================================\n--- code-server.orig/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts\n+++ code-server/lib/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.ts\n@@ -120,7 +120,7 @@ export abstract class AbstractExtensionR\n \t\t\t\t\t: version,\n \t\t\t\tpath: 'extension'\n \t\t\t}));\n-\t\t\treturn this._isWebExtensionResourceEndPoint(uri) ? uri.with({ scheme: RemoteAuthorities.getPreferredWebSchema() }) : uri;\n+\t\t\treturn this._isWebExtensionResourceEndPoint(uri) ? URI.joinPath(URI.parse(window.location.href), uri.path) : uri;","sourceCodeStart":268,"sourceCodeEnd":304,"githubUrl":"https://github.com/coder/code-server/blob/51f90a376b42e217b38937410fe2855e0c1db87e/patches/base-path.diff#L268-L304","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure code-server's HTML template (the page that injects the config element and attribute) is the one being served — clear cache / rebuild.","Re-apply the patches against the matching VS Code version: the base-path.diff context lines must align.","Verify the DOM contains the expected element (e.g. the script/element holding data-settings) before the workbench bootstraps.","Check the network response for the workbench HTML to confirm the injected config attribute is present."],"exampleFix":"// In the served HTML, ensure the config element exists:\n// <div id=\"vscode-remote-bootstrap\" data-settings=\"{...escaped JSON...}\"></div>\n// If a patch removed it, restore the element injection in the code-server template.","handlingStrategy":"validation","validationCode":"// Server-side: confirm the config element attribute is set before serving workbench HTML.\nfunction assertConfigInjected(html: string) {\n  if (!/data-settings=/.test(html)) throw new Error('Config element not injected')\n  return html\n}","typeGuard":"// In the browser bootstrap\nfunction hasConfigElement(doc: Document): boolean {\n  const el = document.getElementById('vscode-remote-bootstrap')\n  return !!el && !!el.getAttribute('data-settings')\n}","tryCatchPattern":"try {\n  bootstrap()\n} catch (e) {\n  if (/Missing web configuration element/.test(e.message)) {\n    location.reload(true) // retry once after cache-bust\n  }\n}","preventionTips":["Re-apply patches against the exact VS Code version they target.","Rebuild the workbench after patching.","Clear browser/CDN cache of the workbench HTML shell.","Verify the injected config attribute exists in the served HTML response."],"tags":["workbench","bootstrap","dom","patch","config"],"backgroundTag":null,"analyzedSha":"51f90a376b42e217b38937410fe2855e0c1db87e","analyzedAt":"2026-08-12T11:27:34.273Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}