{"record":{"id":"6833a5afc367be3e","repo":"wavetermdev/waveterm","slug":"results-error","errorCode":null,"errorMessage":"results.error","messagePattern":"results\\.error","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"emain/emain-web.ts","lineNumber":62,"sourceCode":"        return null;\n    }\n    const escapedSelector = escapeSelector(selector);\n    const queryMethod = opts?.all ? \"querySelectorAll\" : \"querySelector\";\n    const prop = opts?.inner ? \"innerHTML\" : \"outerHTML\";\n    const execExpr = `\n    (() => {\n        const toArr = x => (x instanceof NodeList) ? Array.from(x) : (x ? [x] : []);\n        try {\n            const result = document.${queryMethod}(\"${escapedSelector}\");\n            const value = toArr(result).map(el => el.${prop});\n            return { value };\n        } catch (error) {\n            return { error: error.message };\n        }\n    })()`;\n    const results = await wc.executeJavaScript(execExpr);\n    if (results.error) {\n        throw new Error(results.error);\n    }\n    return results.value;\n}\n","sourceCodeStart":44,"sourceCodeEnd":66,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/emain/emain-web.ts#L44-L66","documentation":"After running `uname -sm`, GetClientPlatform normalizes the output and requires exactly two whitespace-separated fields (kernel-name and machine). If the output splits into anything other than 2 fields, this error is returned with the raw output. It indicates the remote `uname` produced malformed or polluted output.","triggerScenarios":"InstallWsh calls GetClientPlatform and `uname -sm` returns 0 fields (empty) or more than 2 fields (extra text such as shell banners prepended to output).","commonSituations":"Shell rc files echo banners/motd into non-interactive command output; empty output because uname silently failed; vendor-modified uname emitting extra fields.","solutions":["Remove echo/banner statements from shell startup files (.bashrc/.profile) for non-interactive shells","Run `uname -sm` manually inside the distro and check it prints exactly two fields like \"linux x86_64\"","If uname is empty, fix the distro image or install coreutils","Alternatively use GetClientPlatformFromOsArchStr with a known-good string"],"exampleFix":"// before (in ~/.bashrc of the remote)\necho \"Welcome to my distro\"  # pollutes uname output -> 3+ fields\n// after\ncase $- in\n  *i*) echo \"Welcome to my distro\" ;; # only print banner in interactive shells\nesac","handlingStrategy":"validation","validationCode":"out, _ := genconn.RunSimpleCommand(ctx, shell, genconn.CommandSpec{Cmd: \"uname -sm\"})\nif len(strings.Fields(strings.TrimSpace(out))) != 2 {\n    return fmt.Errorf(\"remote uname output polluted: %q\", out)\n}","typeGuard":null,"tryCatchPattern":"os, arch, err := wslconn.GetClientPlatform(ctx, shell)\nif err != nil && strings.Contains(err.Error(), \"unexpected output from uname\") {\n    // check remote shell rc files for banner/echo statements\n}","preventionTips":["Keep shell startup files silent for non-interactive shells (guard banners with $- check)","Test `uname -sm` output shape on new distro images before enabling wsh","Avoid wrapping `uname` with scripts that append extra output"],"tags":["wsl","uname","output-parsing","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"}