{"record":{"id":"df31509d8fc17937","repo":"eythaann/Seelen-UI","slug":"invalid-widget-id","errorCode":null,"errorMessage":"Invalid widget id","messagePattern":"Invalid widget id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/ui/vanilla/entry-point/_tauri.ts","lineNumber":29,"sourceCode":"      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\");\n    }\n    return id;\n  }\n}\n\nfunction decodeUrlSafeBase64(base64Str: string) {\n  let standardBase64 = base64Str.replace(/-/g, \"+\").replace(/_/g, \"/\");\n  const padLength = (4 - (standardBase64.length % 4)) % 4;\n  standardBase64 += \"=\".repeat(padLength);\n  return atob(standardBase64);\n}\n\nexport const webviewInfo = new WebviewInformation();\n\nexport function _invoke<T>(cmd: string, args?: InvokeArgs, options?: InvokeOptions): Promise<T> {\n  return window.__TAURI_INTERNALS__!.invoke(cmd, args, options);\n}\n","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/eythaann/Seelen-UI/blob/dee4aaa94066c5d0888ab25554864862fc47be15/src/ui/vanilla/entry-point/_tauri.ts#L11-L47","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check how the widget webview is created and ensure the label starts with the widget id before any `?` query string.","Log `webviewInfo.label` at startup to see the actual label and fix the producer of the malformed label.","Update Seelen UI / libs if a version change altered the label format (`id?params`)."],"exampleFix":"// before\nconst [id, _] = this.label.split(\"?\");\nif (!id) throw new Error(\"Invalid widget id\");\n// after\nconst [id, _] = this.label.split(\"?\");\nif (!id) {\n  console.error(\"Raw label:\", this.label);\n  throw new Error(`Invalid widget id from label \"${this.label}\"`);\n}","handlingStrategy":"validation","validationCode":"const label = webviewInfo.label;\nif (!label || label.startsWith(\"?\")) {\n  // malformed label — do not attempt widgetId extraction\n}","typeGuard":"function hasWidgetIdLabel(label: string): boolean {\n  const id = label.split(\"?\")[0];\n  return typeof id === \"string\" && id.length > 0;\n}","tryCatchPattern":"let widgetId: string;\ntry {\n  widgetId = webviewInfo.widgetId;\n} catch (e) {\n  if ((e as Error).message === \"Invalid widget id\") {\n    console.error(\"Malformed webview label:\", webviewInfo.label);\n    widgetId = \"unknown\";\n  } else throw e;\n}","preventionTips":["Ensure webview creation always prefixes the label with the widget id before the `?`.","Log the raw label when bootstrap fails to spot format regressions.","Pin/test label format assumptions when upgrading Seelen UI versions."],"tags":["widget","webview-label","bootstrap"],"backgroundTag":"invalid-widget-id","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"}