wavetermdev/waveterm · error

unsupported wsh platform

Error message

unsupported wsh platform: %s-%s

What it means

GetLocalWshBinaryPath computes the platform-specific wsh binary name (wsh-<version>-<goos>-<goarch>[.exe]) but first verifies the goos-goarch pair is in wavebase.SupportedWshBinaries; if not, it returns this error. The wsh binary is only built for a fixed matrix of platforms.

Solutions

  1. Check wavebase.ValidateWshSupportedArch(goos, goarch) before calling and handle unsupported hosts differently
  2. Only invoke on supported pairs listed in wavebase.SupportedWshBinaries
  3. Don't set GOOS/GOARCH environment overrides that alter the resolved platform
  4. Build a custom wsh binary and add the platform to SupportedWshBinaries if you genuinely need it

Example fix

// before
path, err := shellutil.GetLocalWshBinaryPath()
// after
if !wavebase.ValidateWshSupportedArch(runtime.GOOS, runtime.GOARCH) {
	return fmt.Errorf("wsh not available for %s-%s", runtime.GOOS, runtime.GOARCH)
}
path, err := shellutil.GetLocalWshBinaryPath()
Defensive patterns

Strategy: validation

Validate before calling

if !wavebase.ValidateWshSupportedArch(goos, goarch) {
	return fmt.Errorf("wsh binary not available for %s-%s", goos, goarch)
}
path, err := shellutil.GetLocalWshBinaryPath()

Try / catch

path, err := shellutil.GetLocalWshBinaryPath()
if err != nil {
	if strings.Contains(err.Error(), "unsupported wsh platform") {
		return fmt.Errorf("remote host platform not supported by wsh: %v", err)
	}
	return err
}

Prevention

When it happens

Trigger: Calling GetLocalWshBinaryPath when the resolved GOOS/GOARCH pair (overridable via environment/target vars) is not in the supported map — e.g. freebsd, openbsd, 386, or riscv64 builds, or a custom GOARCH override in the shell environment.

Common situations: Building/running Wave on an unsupported architecture (e.g. linux-386 or freebsd-amd64); environment variables GOOS/GOARCH set to unusual values leaking into the function; attempting remote connections to hosts on unsupported platforms.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at pkg/util/shellutil/shellutil.go:349

		return ZshExtendedHistoryPattern.MatchString(line), nil
	}

	return false, nil
}

func GetLocalWshBinaryPath(version string, goos string, goarch string) (string, error) {
	ext := ""
	if goarch == "amd64" {
		goarch = "x64"
	}
	if goarch == "aarch64" {
		goarch = "arm64"
	}
	if goos == "windows" {
		ext = ".exe"
	}
	if !wavebase.SupportedWshBinaries[fmt.Sprintf("%s-%s", goos, goarch)] {
		return "", fmt.Errorf("unsupported wsh platform: %s-%s", goos, goarch)
	}
	baseName := fmt.Sprintf("wsh-%s-%s.%s%s", version, goos, goarch, ext)
	return filepath.Join(wavebase.GetWaveAppBinPath(), baseName), nil
}

// absWshBinDir must be an absolute, expanded path (no ~ or $HOME, etc.)
// it will be hard-quoted appropriately for the shell
func InitRcFiles(waveHome string, absWshBinDir string) error {
	// ensure directories exist
	zshDir := filepath.Join(waveHome, ZshIntegrationDir)
	err := wavebase.CacheEnsureDir(zshDir, ZshIntegrationDir, 0755, ZshIntegrationDir)
	if err != nil {
		return err
	}
	bashDir := filepath.Join(waveHome, BashIntegrationDir)
	err = wavebase.CacheEnsureDir(bashDir, BashIntegrationDir, 0755, BashIntegrationDir)
	if err != nil {
		return err

View on GitHub (pinned to a4447c1563)