wavetermdev/waveterm · error

results.error

Error message

results.error

What it means

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.

Source

Thrown at emain/emain-web.ts:62

        return null;
    }
    const escapedSelector = escapeSelector(selector);
    const queryMethod = opts?.all ? "querySelectorAll" : "querySelector";
    const prop = opts?.inner ? "innerHTML" : "outerHTML";
    const execExpr = `
    (() => {
        const toArr = x => (x instanceof NodeList) ? Array.from(x) : (x ? [x] : []);
        try {
            const result = document.${queryMethod}("${escapedSelector}");
            const value = toArr(result).map(el => el.${prop});
            return { value };
        } catch (error) {
            return { error: error.message };
        }
    })()`;
    const results = await wc.executeJavaScript(execExpr);
    if (results.error) {
        throw new Error(results.error);
    }
    return results.value;
}

View on GitHub (pinned to a4447c1563)

Solutions

  1. Remove echo/banner statements from shell startup files (.bashrc/.profile) for non-interactive shells
  2. Run `uname -sm` manually inside the distro and check it prints exactly two fields like "linux x86_64"
  3. If uname is empty, fix the distro image or install coreutils
  4. Alternatively use GetClientPlatformFromOsArchStr with a known-good string

Example fix

// before (in ~/.bashrc of the remote)
echo "Welcome to my distro"  # pollutes uname output -> 3+ fields
// after
case $- in
  *i*) echo "Welcome to my distro" ;; # only print banner in interactive shells
esac
Defensive patterns

Strategy: validation

Validate before calling

out, _ := genconn.RunSimpleCommand(ctx, shell, genconn.CommandSpec{Cmd: "uname -sm"})
if len(strings.Fields(strings.TrimSpace(out))) != 2 {
    return fmt.Errorf("remote uname output polluted: %q", out)
}

Try / catch

os, arch, err := wslconn.GetClientPlatform(ctx, shell)
if err != nil && strings.Contains(err.Error(), "unexpected output from uname") {
    // check remote shell rc files for banner/echo statements
}

Prevention

When it happens

Trigger: InstallWsh calls GetClientPlatform and `uname -sm` returns 0 fields (empty) or more than 2 fields (extra text such as shell banners prepended to output).

Common situations: Shell rc files echo banners/motd into non-interactive command output; empty output because uname silently failed; vendor-modified uname emitting extra fields.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/6833a5afc367be3e. Report an issue: GitHub.