{"record":{"id":"cc6bc0b981c6e65f","repo":"eythaann/Seelen-UI","slug":"missing-webview-label","errorCode":null,"errorMessage":"Missing webview label","messagePattern":"Missing webview label","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/ui/vanilla/entry-point/_tauri.ts","lineNumber":11,"sourceCode":"// this file is used to reduce bundle size on widget loader, to mantain the minimal bundle size possible\n// this file can't use dependencies\nimport type { InvokeArgs, InvokeOptions } from \"@tauri-apps/api/core\";\n\nclass WebviewInformation {\n  _label: string | null = null;\n\n  get rawLabel() {\n    let label = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;\n    if (!label) {\n      throw new Error(\"Missing webview label\");\n    }\n    return label;\n  }\n\n  get label() {\n    if (this._label) {\n      return this._label;\n    }\n\n    const viewLabel = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;\n    this._label = viewLabel ? decodeUrlSafeBase64(viewLabel) : \"Unknown\";\n    return this._label;\n  }\n\n  get widgetId() {\n    const [id, _] = this.label.split(\"?\");\n    if (!id) {\n      throw new Error(\"Invalid widget id\");","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/eythaann/Seelen-UI/blob/dee4aaa94066c5d0888ab25554864862fc47be15/src/ui/vanilla/entry-point/_tauri.ts#L1-L29","documentation":"`WebviewInformation.rawLabel` reads the webview label from Tauri internals (`window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label`). It throws `Missing webview label` when the label is absent, meaning the code is not running inside a properly initialized Tauri webview or Tauri internals were not injected.","triggerScenarios":"Running the frontend bundle in a plain browser / dev server where `__TAURI_INTERNALS__` is undefined; using an old or custom Tauri runtime where the `metadata.currentWebview` structure changed; accessing `rawLabel` before Tauri's initialization script ran.","commonSituations":"Opening the widget UI via `npm run dev`/browser preview instead of inside the Seelen UI webview; Tauri version upgrade renaming internals; unit tests rendering the module in jsdom without a Tauri mock.","solutions":["Run the code inside a Tauri webview (via Seelen UI / `npm run tauri dev`), not a plain browser.","Mock `window.__TAURI_INTERNALS__.metadata.currentWebview.label` in tests/browser previews.","Check your Tauri version's internals path; adapt the lookup if `metadata.currentWebview` moved."],"exampleFix":"// before\nlet label = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;\n// after (defensive access with mock support)\nlet label = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label\n  ?? window.__MOCK_WEBVIEW_LABEL__;\n","handlingStrategy":"type-guard","validationCode":"if (typeof window === \"undefined\" || !window.__TAURI_INTERNALS__?.metadata?.currentWebview) {\n  // not inside a Tauri webview — skip Tauri-dependent bootstrap\n}","typeGuard":"function inTauriWebview(): boolean {\n  return typeof window !== \"undefined\"\n    && !!window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;\n}","tryCatchPattern":"let label: string;\ntry {\n  label = webviewInfo.rawLabel;\n} catch (e) {\n  if ((e as Error).message === \"Missing webview label\") {\n    label = \"dev-fallback\"; // browser/test environment\n  } else throw e;\n}","preventionTips":["Only exercise widget entry code inside a Tauri webview; guard browser/dev-server paths.","Mock __TAURI_INTERNALS__ in tests and previews.","Re-check internals access after Tauri version upgrades."],"tags":["tauri","webview","bootstrap","environment"],"backgroundTag":"missing-webview-label","analyzedSha":"dee4aaa94066c5d0888ab25554864862fc47be15","analyzedAt":"2026-09-03T10:20:37.842Z","contentChangedAt":"2026-09-03T10:20:37.842Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}