{"record":{"id":"109487eb46ac6f4b","repo":"wavetermdev/waveterm","slug":"tabid-and-blockid-are-required","errorCode":null,"errorMessage":"tabid and blockid are required","messagePattern":"tabid and blockid are required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"emain/emain-wsh.ts","lineNumber":20,"sourceCode":"// SPDX-License-Identifier: Apache-2.0\n\nimport { WindowService } from \"@/app/store/services\";\nimport { RpcResponseHelper, WshClient } from \"@/app/store/wshclient\";\nimport { RpcApi } from \"@/app/store/wshclientapi\";\nimport { Notification, net, safeStorage, shell } from \"electron\";\nimport { getResolvedUpdateChannel } from \"emain/updater\";\nimport { unamePlatform } from \"./emain-platform\";\nimport { getWebContentsByBlockId, webGetSelector } from \"./emain-web\";\nimport { createBrowserWindow, getWaveWindowById, getWaveWindowByWorkspaceId } from \"./emain-window\";\n\nexport class ElectronWshClientType extends WshClient {\n    constructor() {\n        super(\"electron\");\n    }\n\n    async handle_webselector(rh: RpcResponseHelper, data: CommandWebSelectorData): Promise<string[]> {\n        if (!data.tabid || !data.blockid || !data.workspaceid) {\n            throw new Error(\"tabid and blockid are required\");\n        }\n        const ww = getWaveWindowByWorkspaceId(data.workspaceid);\n        if (ww == null) {\n            throw new Error(`no window found with workspace ${data.workspaceid}`);\n        }\n        const wc = await getWebContentsByBlockId(ww, data.tabid, data.blockid);\n        if (wc == null) {\n            throw new Error(`no webcontents found with blockid ${data.blockid}`);\n        }\n        const rtn = await webGetSelector(wc, data.selector, data.opts);\n        return rtn;\n    }\n\n    async handle_notify(rh: RpcResponseHelper, notificationOptions: WaveNotificationOptions) {\n        new Notification({\n            title: notificationOptions.title,\n            body: notificationOptions.body,\n            silent: notificationOptions.silent,","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/emain/emain-wsh.ts#L2-L38","documentation":"GetClientPlatformFromOsArchStr parses a pre-captured os/arch string (as produced by uname) and requires exactly two fields. Unlike GetClientPlatform it does not run a command; it only splits and normalizes the given string. This error means the supplied string did not split into exactly two whitespace-separated tokens.","triggerScenarios":"InstallWsh (or other callers) pass an osArchStr — e.g. one cached from a previous version query — that is empty, contains one token, or has extra tokens.","commonSituations":"Caching the osArchStr after it was truncated; passing a raw version line instead of the uname line; extra whitespace/format changes between versions of the conncontroller output.","solutions":["Log and inspect the exact osArchStr being passed before the call","Re-acquire a fresh `uname -sm` output string instead of reusing a cached/stale value","Trim and ensure the string is in the form \"<os> <arch>\" (e.g. \"linux x86_64\") before calling","Use GetClientPlatform (which runs uname itself) if you don't have a reliable string"],"exampleFix":"// before\nos, arch, err := GetClientPlatformFromOsArchStr(ctx, cachedLine) // cachedLine may be a version string\n// after\nosArchStr := strings.TrimSpace(strings.Join(strings.Fields(unameOutput)[0:2], \" \"))\nos, arch, err := GetClientPlatformFromOsArchStr(ctx, osArchStr)","handlingStrategy":"validation","validationCode":"func validOsArchStr(s string) bool {\n    return len(strings.Fields(strings.TrimSpace(s))) == 2\n}","typeGuard":"func isTwoFields(s string) bool {\n    return len(strings.Fields(strings.TrimSpace(s))) == 2\n}","tryCatchPattern":"os, arch, err := wslconn.GetClientPlatformFromOsArchStr(ctx, osArchStr)\nif err != nil && strings.Contains(err.Error(), \"unexpected output\") {\n    // re-acquire fresh uname output instead of the cached string\n}","preventionTips":["Validate cached os/arch strings are two tokens before reuse","Never pass version or banner lines where a uname line is expected","Prefer GetClientPlatform (runs uname live) over cached strings when unsure"],"tags":["wsl","parsing","uname","wsh-install"],"backgroundTag":"unexpected-command-output","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}