eythaann/Seelen-UI · error · Error
Missing webview label
Error message
Missing webview label
What it means
`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.
Source
Thrown at src/ui/vanilla/entry-point/_tauri.ts:11
// this file is used to reduce bundle size on widget loader, to mantain the minimal bundle size possible
// this file can't use dependencies
import type { InvokeArgs, InvokeOptions } from "@tauri-apps/api/core";
class WebviewInformation {
_label: string | null = null;
get rawLabel() {
let label = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;
if (!label) {
throw new Error("Missing webview label");
}
return label;
}
get label() {
if (this._label) {
return this._label;
}
const viewLabel = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;
this._label = viewLabel ? decodeUrlSafeBase64(viewLabel) : "Unknown";
return this._label;
}
get widgetId() {
const [id, _] = this.label.split("?");
if (!id) {
throw new Error("Invalid widget id");View on GitHub (pinned to dee4aaa940)
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.
Example fix
// before let label = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label; // after (defensive access with mock support) let label = window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label ?? window.__MOCK_WEBVIEW_LABEL__;
Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof window === "undefined" || !window.__TAURI_INTERNALS__?.metadata?.currentWebview) {
// not inside a Tauri webview — skip Tauri-dependent bootstrap
} Type guard
function inTauriWebview(): boolean {
return typeof window !== "undefined"
&& !!window.__TAURI_INTERNALS__?.metadata?.currentWebview?.label;
} Try / catch
let label: string;
try {
label = webviewInfo.rawLabel;
} catch (e) {
if ((e as Error).message === "Missing webview label") {
label = "dev-fallback"; // browser/test environment
} else throw e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The library is being used on a non Seelen UI environment
- Missing widget id on webview label
- Root element not found
- Widget definition not found for ${currentWidgetId}
- Invalid widget id
AI-assisted analysis of eythaann/Seelen-UI@dee4aaa940 (2026-09-03).
Data as JSON: /api/errors/cc6bc0b981c6e65f.
Report an issue: GitHub.