wavetermdev/waveterm · warning

unsupported shell type: %s

Error message

unsupported shell type: %s

What it means

getShellVersion builds a `--version` command only for the shells it supports (bash, zsh, fish, pwsh). Since DetectShellTypeAndVersionFromPath already filters unknowns, this default branch fires if a new ShellType constant is added without a version-probe case, or if the function is called directly with an unhandled type. It returns the raw shell type string in the message.

Source

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

	var cmd *exec.Cmd
	var versionRegex *regexp.Regexp

	switch shellType {
	case ShellType_bash:
		cmd = exec.CommandContext(ctx, shellPath, "--version")
		versionRegex = bashVersionRegexp
	case ShellType_zsh:
		cmd = exec.CommandContext(ctx, shellPath, "--version")
		versionRegex = zshVersionRegexp
	case ShellType_fish:
		cmd = exec.CommandContext(ctx, shellPath, "--version")
		versionRegex = fishVersionRegexp
	case ShellType_pwsh:
		cmd = exec.CommandContext(ctx, shellPath, "--version")
		versionRegex = pwshVersionRegexp
	default:
		return "", fmt.Errorf("unsupported shell type: %s", shellType)
	}

	output, err := cmd.CombinedOutput()
	if err != nil {
		return "", fmt.Errorf("failed to get version for %s: %w", shellType, err)
	}

	outputStr := strings.TrimSpace(string(output))
	matches := versionRegex.FindStringSubmatch(outputStr)
	if len(matches) < 2 {
		return "", fmt.Errorf("failed to parse version from output: %q", outputStr)
	}

	return matches[1], nil
}

func FixupWaveZshHistory() error {
	if runtime.GOOS != "darwin" {

View on GitHub (pinned to a4447c1563)

Solutions

  1. Add a case for the missing shell type in getShellVersion with its --version command and a version regex.
  2. Route all callers through DetectShellTypeAndVersionFromPath so unknown types are rejected earlier.
  3. Update the call site to only request versions for supported shell types.
  4. If you hit this as a user, it is an internal bug — report it with your shell type and use a supported shell meanwhile.

Example fix

// before
default:
    return "", fmt.Errorf("unsupported shell type: %s", shellType)
// after
case ShellType_nu:
    cmd = exec.CommandContext(ctx, shellPath, "--version")
    versionRegex = nuVersionRegexp
default:
    return "", fmt.Errorf("unsupported shell type: %s", shellType)
Defensive patterns

Strategy: type-guard

Validate before calling

// only request versions for types the switch supports
shellType := shellutil.GetShellTypeFromShellPath(shellPath)
switch shellType {
case shellutil.ShellType_bash, shellutil.ShellType_zsh, shellutil.ShellType_fish, shellutil.ShellType_pwsh:
	// safe to probe version
	st, v, err := shellutil.DetectShellTypeAndVersionFromPath(shellPath)
default:
	return fmt.Errorf("no version probe for shell type %q", shellType)
}

Type guard

func hasVersionProbe(shellType string) bool {
	switch shellType {
	case "bash", "zsh", "fish", "pwsh", "powershell":
		return true
	}
	return false
}

Try / catch

st, v, err := shellutil.DetectShellTypeAndVersionFromPath(path)
if err != nil {
	if strings.HasPrefix(err.Error(), "unsupported shell type") {
		return st, "", nil // treat version as unknown, not fatal
	}
	return st, "", err
}

Prevention

When it happens

Trigger: Calling getShellVersion (via DetectShellTypeAndVersionFromPath) with a shell type that has no case in the switch — in practice a code-path/ABI drift: a newly added shell type constant not yet handled, or direct internal calls bypassing detection.

Common situations: Developers extending shellutil with a new shell (e.g. nushell) and forgetting the switch case; tests invoking getShellVersion with synthetic types; version skew between plugins calling internals.

Related errors


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