{"record":{"id":"77ae67f02d613bf2","repo":"authelia/authelia","slug":"no-variablename-embedded-variable-detected","errorCode":null,"errorMessage":"No ${variableName} embedded variable detected","messagePattern":"No (.+?) embedded variable detected","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"web/src/utils/Configuration.ts","lineNumber":4,"sourceCode":"export function getEmbeddedVariable(variableName: string) {\n    const value = document.body.getAttribute(`data-${variableName}`);\n    if (value === null) {\n        throw new Error(`No ${variableName} embedded variable detected`);\n    }\n\n    return value;\n}\n\nexport function getDuoSelfEnrollment() {\n    return getEmbeddedVariable(\"duoselfenrollment\") === \"true\";\n}\n\nexport function getLogoOverride() {\n    return getEmbeddedVariable(\"logooverride\") === \"true\";\n}\n\nexport function getRememberMe() {\n    return getEmbeddedVariable(\"rememberme\") === \"true\";\n}\n\nexport function getResetPassword() {","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/authelia/authelia/blob/c883b8d3d8f278d61e2627e317be2e9ddc09e15b/web/src/utils/Configuration.ts#L1-L22","documentation":"getEmbeddedVariable reads data-{name} attributes that Authelia's backend injects into the <body> tag of the templated index.html (e.g. data-duoselfenrollment, data-logooverride, data-theme, data-rememberme, data-resetpassword). The throw means the attribute is absent, i.e. the HTML was not rendered by Authelia's server-side template. This usually breaks the portal at bootstrap, since these flags drive first-factor options and theming.","triggerScenarios":"Loading the SPA from a source that does not template index.html: the vite dev server or a static file server hosting web/ directly; a deployment that strips body attributes; a stale cached index.html from a CDN or service worker after an upgrade.","commonSituations":"Running the frontend standalone in development; nginx serving the built assets instead of proxying to Authelia; an over-aggressive HTML minifier or CDN rewriting the body tag; accessing the portal through a cache holding a pre-render artifact.","solutions":["Serve the SPA through the Authelia backend so index.html is templated with the data-* attributes","If serving statically (dev), add the attributes manually to web/index.html's body tag","View page source and confirm <body> carries data-duoselfenrollment etc.; purge CDN/service-worker caches if not","Check the attribute name matches exactly: the lookup is `data-${variableName}` verbatim, all lowercase","After upgrades, hard-refresh or bust the index.html cache"],"exampleFix":"<!-- before -->\n<body>\n\n<!-- after (dev/static hosting; Authelia injects these server-side in production) -->\n<body data-duoselfenrollment=\"false\" data-logooverride=\"false\" data-theme=\"auto\" data-rememberme=\"true\" data-resetpassword=\"true\">","handlingStrategy":"validation","validationCode":"const name = 'duoselfenrollment';\nif (!document.body.hasAttribute(`data-${name}`)) {\n    // HTML not templated by Authelia: fall back to defaults or block boot with a clear message\n    return fallbackDefaults[name];\n}\nreturn getEmbeddedVariable(name);","typeGuard":"function hasEmbeddedVariable(name: string): boolean {\n    return document.body.getAttribute(`data-${name}`) !== null;\n}","tryCatchPattern":"try {\n    return getEmbeddedVariable('duoselfenrollment') === 'true';\n} catch (err) {\n    if (err instanceof Error && err.message.includes('embedded variable')) {\n        return false; // safe default; log loudly because the deployment is misconfigured\n    }\n    throw err;\n}","preventionTips":["Always serve the portal through Authelia so index.html is templated","Smoke-test deployments with view-source: <body> must show the data-* attributes","Bust CDN/service-worker caches for index.html after upgrades"],"tags":["configuration","bootstrap","embedded-variables","deployment"],"backgroundTag":null,"analyzedSha":"c883b8d3d8f278d61e2627e317be2e9ddc09e15b","analyzedAt":"2026-08-15T21:33:05.930Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}