{"record":{"id":"78c6d10aa646f97a","repo":"wavetermdev/waveterm","slug":"unsupported-shell-type-s","errorCode":null,"errorMessage":"unsupported shell type: %s","messagePattern":"unsupported shell type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/util/shellutil/shellutil.go","lineNumber":534,"sourceCode":"\n\tvar cmd *exec.Cmd\n\tvar versionRegex *regexp.Regexp\n\n\tswitch shellType {\n\tcase ShellType_bash:\n\t\tcmd = exec.CommandContext(ctx, shellPath, \"--version\")\n\t\tversionRegex = bashVersionRegexp\n\tcase ShellType_zsh:\n\t\tcmd = exec.CommandContext(ctx, shellPath, \"--version\")\n\t\tversionRegex = zshVersionRegexp\n\tcase ShellType_fish:\n\t\tcmd = exec.CommandContext(ctx, shellPath, \"--version\")\n\t\tversionRegex = fishVersionRegexp\n\tcase ShellType_pwsh:\n\t\tcmd = exec.CommandContext(ctx, shellPath, \"--version\")\n\t\tversionRegex = pwshVersionRegexp\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unsupported shell type: %s\", shellType)\n\t}\n\n\toutput, err := cmd.CombinedOutput()\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to get version for %s: %w\", shellType, err)\n\t}\n\n\toutputStr := strings.TrimSpace(string(output))\n\tmatches := versionRegex.FindStringSubmatch(outputStr)\n\tif len(matches) < 2 {\n\t\treturn \"\", fmt.Errorf(\"failed to parse version from output: %q\", outputStr)\n\t}\n\n\treturn matches[1], nil\n}\n\nfunc FixupWaveZshHistory() error {\n\tif runtime.GOOS != \"darwin\" {","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/util/shellutil/shellutil.go#L516-L552","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add a case for the missing shell type in getShellVersion with its --version command and a version regex.","Route all callers through DetectShellTypeAndVersionFromPath so unknown types are rejected earlier.","Update the call site to only request versions for supported shell types.","If you hit this as a user, it is an internal bug — report it with your shell type and use a supported shell meanwhile."],"exampleFix":"// before\ndefault:\n    return \"\", fmt.Errorf(\"unsupported shell type: %s\", shellType)\n// after\ncase ShellType_nu:\n    cmd = exec.CommandContext(ctx, shellPath, \"--version\")\n    versionRegex = nuVersionRegexp\ndefault:\n    return \"\", fmt.Errorf(\"unsupported shell type: %s\", shellType)","handlingStrategy":"type-guard","validationCode":"// only request versions for types the switch supports\nshellType := shellutil.GetShellTypeFromShellPath(shellPath)\nswitch shellType {\ncase shellutil.ShellType_bash, shellutil.ShellType_zsh, shellutil.ShellType_fish, shellutil.ShellType_pwsh:\n\t// safe to probe version\n\tst, v, err := shellutil.DetectShellTypeAndVersionFromPath(shellPath)\ndefault:\n\treturn fmt.Errorf(\"no version probe for shell type %q\", shellType)\n}","typeGuard":"func hasVersionProbe(shellType string) bool {\n\tswitch shellType {\n\tcase \"bash\", \"zsh\", \"fish\", \"pwsh\", \"powershell\":\n\t\treturn true\n\t}\n\treturn false\n}","tryCatchPattern":"st, v, err := shellutil.DetectShellTypeAndVersionFromPath(path)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"unsupported shell type\") {\n\t\treturn st, \"\", nil // treat version as unknown, not fatal\n\t}\n\treturn st, \"\", err\n}","preventionTips":["When adding a new ShellType constant, add the matching case in getShellVersion in the same change.","Add a table-driven test enumerating every ShellType against getShellVersion.","Don't call getShellVersion directly with synthetic/unregistered shell types.","Keep shell-type constants and probe switches in one file to make omissions obvious in review."],"tags":["shell-detection","version-probe","unimplemented-case"],"backgroundTag":"unsupported-shell-type","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}