wavetermdev/waveterm · error
unexpected output from uname: %s
Error message
unexpected output from uname: %s
What it means
After successfully running 'uname -sm', GetClientPlatform parses the output expecting exactly two whitespace-separated fields (OS and architecture). This error is thrown when the lowercased, trimmed output does not split into exactly 2 fields, so the platform cannot be normalized. Unlike the run-failure error, the command succeeded but returned unexpected text.
Source
Thrown at pkg/remote/connutil.go:71
arch = "arm64"
}
return arch
}
// returns (os, arch, error)
// guaranteed to return a supported platform
func GetClientPlatform(ctx context.Context, shell genconn.ShellClient) (string, string, error) {
blocklogger.Infof(ctx, "[conndebug] running `uname -sm` to detect client platform\n")
stdout, stderr, err := genconn.RunSimpleCommand(ctx, shell, genconn.CommandSpec{
Cmd: "uname -sm",
})
if err != nil {
return "", "", fmt.Errorf("error running uname -sm: %w, stderr: %s", err, stderr)
}
// Parse and normalize output
parts := strings.Fields(strings.ToLower(strings.TrimSpace(stdout)))
if len(parts) != 2 {
return "", "", fmt.Errorf("unexpected output from uname: %s", stdout)
}
os, arch := normalizeOs(parts[0]), normalizeArch(parts[1])
if err := wavebase.ValidateWshSupportedArch(os, arch); err != nil {
return "", "", err
}
return os, arch, nil
}
func GetClientPlatformFromOsArchStr(ctx context.Context, osArchStr string) (string, string, error) {
parts := strings.Fields(strings.TrimSpace(osArchStr))
if len(parts) != 2 {
return "", "", fmt.Errorf("unexpected output from uname: %s", osArchStr)
}
os, arch := normalizeOs(parts[0]), normalizeArch(parts[1])
if err := wavebase.ValidateWshSupportedArch(os, arch); err != nil {
return "", "", err
}
return os, arch, nilView on GitHub (pinned to a4447c1563)
Solutions
- SSH into the remote host and run 'uname -sm' manually; remove any echo/banner output from shell startup files that pollutes stdout.
- Check that the login shell for the remote user is a standard shell (bash/sh/zsh) without custom wrappers.
- If uname output is genuinely non-standard, fall back to GetClientPlatformFromOsArchStr with a known os/arch string.
- Inspect the string embedded in the error to see the actual polluted output and fix accordingly.
Example fix
// before (remote ~/.bashrc) echo "Welcome to my server" // after [ -z "$PS1" ] || echo "Welcome to my server" # only for interactive shells
Defensive patterns
Strategy: fallback
Validate before calling
if err := shell.Run(ctx, "uname -sm"); err != nil {
return err
} // and inspect output has exactly 2 fields before calling GetClientPlatform indirectly Try / catch
os, arch, err := connutil.GetClientPlatform(ctx, shell)
if err != nil && strings.Contains(err.Error(), "unexpected output from uname") {
os, arch, err = connutil.GetClientPlatformFromOsArchStr(ctx, manualOsArch)
} Prevention
- Keep remote shell startup files (.bashrc/.profile) free of stdout output for non-interactive sessions.
- Gate any echo/banner statements behind a [ -t 0 ] or $PS1 interactive check.
- Use standard login shells (bash/sh/zsh) without wrappers for the connection user.
- Cache a known-good os/arch string and use GetClientPlatformFromOsArchStr as a fallback.
When it happens
Trigger: The remote 'uname -sm' output has more or fewer than 2 fields: multi-line output from shell profile banners (motd echoed to stdout), shells wrapping commands, custom PS1/prompt leaking into captured stdout, or a shell printing an error line before uname output.
Common situations: Remote accounts with login banners or 'echo' statements in .bashrc/.profile; restricted shells that print warnings; wrapped/forked shells appending output; non-standard uname implementations printing extra columns.
Related errors
- invalid format of user@host argument
- error running uname -sm: %w, stderr: %s
- invalid ssh remote name (%s): %w
- unexpected version format: %s
- failed to create remote command: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/01e48794411797f1.
Report an issue: GitHub.