eythaann/Seelen-UI · error · Error

Invalid widget id

Error message

Invalid widget id

What it means

`WebviewInformation.widgetId` splits `this.label` on `"?"` and takes the first part as the widget id. It throws `Invalid widget id` when that first segment is empty, i.e. the webview label starts with `?` or is empty. This is a companion guard to `rawLabel`, validating the label's id portion.

Source

Thrown at src/ui/vanilla/entry-point/_tauri.ts:29

      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");
    }
    return id;
  }
}

function decodeUrlSafeBase64(base64Str: string) {
  let standardBase64 = base64Str.replace(/-/g, "+").replace(/_/g, "/");
  const padLength = (4 - (standardBase64.length % 4)) % 4;
  standardBase64 += "=".repeat(padLength);
  return atob(standardBase64);
}

export const webviewInfo = new WebviewInformation();

export function _invoke<T>(cmd: string, args?: InvokeArgs, options?: InvokeOptions): Promise<T> {
  return window.__TAURI_INTERNALS__!.invoke(cmd, args, options);
}

View on GitHub (pinned to dee4aaa940)

Solutions

  1. Check how the widget webview is created and ensure the label starts with the widget id before any `?` query string.
  2. Log `webviewInfo.label` at startup to see the actual label and fix the producer of the malformed label.
  3. Update Seelen UI / libs if a version change altered the label format (`id?params`).

Example fix

// before
const [id, _] = this.label.split("?");
if (!id) throw new Error("Invalid widget id");
// after
const [id, _] = this.label.split("?");
if (!id) {
  console.error("Raw label:", this.label);
  throw new Error(`Invalid widget id from label "${this.label}"`);
}
Defensive patterns

Strategy: validation

Validate before calling

const label = webviewInfo.label;
if (!label || label.startsWith("?")) {
  // malformed label — do not attempt widgetId extraction
}

Type guard

function hasWidgetIdLabel(label: string): boolean {
  const id = label.split("?")[0];
  return typeof id === "string" && id.length > 0;
}

Try / catch

let widgetId: string;
try {
  widgetId = webviewInfo.widgetId;
} catch (e) {
  if ((e as Error).message === "Invalid widget id") {
    console.error("Malformed webview label:", webviewInfo.label);
    widgetId = "unknown";
  } else throw e;
}

Prevention

When it happens

Trigger: A webview label of `""` or `"?query..."` — e.g. a webview was created with a malformed/empty label, or code that builds widget webview labels emitted the id part empty (query params present but id missing).

Common situations: Backend/tooling change in how widget webview labels are constructed; manually creating a webview for testing with a label lacking the id prefix; label encoding regression in the widget launcher.

Related errors


AI-assisted analysis of eythaann/Seelen-UI@dee4aaa940 (2026-09-03). Data as JSON: /api/errors/df31509d8fc17937. Report an issue: GitHub.