{"record":{"id":"adc200fc0e5a5dfd","repo":"wavetermdev/waveterm","slug":"unknown-shell-type-s","errorCode":null,"errorMessage":"unknown shell type: %s","messagePattern":"unknown shell type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/util/shellutil/shellutil.go","lineNumber":497,"sourceCode":"\treturn ShellType_unknown\n}\n\nvar (\n\tbashVersionRegexp = regexp.MustCompile(`\\bversion\\s+(\\d+\\.\\d+)`)\n\tzshVersionRegexp  = regexp.MustCompile(`\\bzsh\\s+(\\d+\\.\\d+)`)\n\tfishVersionRegexp = regexp.MustCompile(`\\bversion\\s+(\\d+\\.\\d+)`)\n\tpwshVersionRegexp = regexp.MustCompile(`(?:PowerShell\\s+)?(\\d+\\.\\d+)`)\n)\n\nfunc DetectShellTypeAndVersion() (string, string, error) {\n\tshellPath := DetectLocalShellPath()\n\treturn DetectShellTypeAndVersionFromPath(shellPath)\n}\n\nfunc DetectShellTypeAndVersionFromPath(shellPath string) (string, string, error) {\n\tshellType := GetShellTypeFromShellPath(shellPath)\n\tif shellType == ShellType_unknown {\n\t\treturn shellType, \"\", fmt.Errorf(\"unknown shell type: %s\", shellPath)\n\t}\n\n\tshellBase := filepath.Base(shellPath)\n\tif shellType == ShellType_pwsh && strings.Contains(shellBase, \"powershell\") && !strings.Contains(shellBase, \"pwsh\") {\n\t\treturn \"powershell\", \"\", nil\n\t}\n\n\tversion, err := getShellVersion(shellPath, shellType)\n\tif err != nil {\n\t\treturn shellType, \"\", err\n\t}\n\n\treturn shellType, version, nil\n}\n\nfunc getShellVersion(shellPath string, shellType string) (string, error) {\n\tctx, cancelFn := context.WithTimeout(context.Background(), 2*time.Second)\n\tdefer cancelFn()","sourceCodeStart":479,"sourceCodeEnd":515,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/pkg/util/shellutil/shellutil.go#L479-L515","documentation":"DetectShellTypeAndVersionFromPath first classifies the shell via GetShellTypeFromShellPath, which only recognizes bash, zsh, fish, and pwsh/powershell substrings in the basename. If the path matches none (ShellType_unknown), it returns this error with the offending path. Wave cannot manage shells it cannot classify.","triggerScenarios":"Calling DetectShellTypeAndVersion (via DetectLocalShellPath) or DetectShellTypeAndVersionFromPath with a path whose basename lacks bash/zsh/fish/pwsh/powershell — e.g. csh, tcsh, nushell, dash, empty path, or a wrapper script named 'myshell'.","commonSituations":"Users with exotic login shells (tcsh, nu, elvish) set as $SHELL; SHELL env var empty in non-login service contexts; custom-named shell symlinks like /usr/bin/sh POSIX sh.","solutions":["Set the user's shell to a supported one (bash, zsh, fish, pwsh) via chsh or install pwsh.","Ensure SHELL is exported and points at a real shell binary before running detection.","Create a symlink whose basename contains the shell name (e.g. ln -s nu /usr/local/bin/... only if truly compatible — otherwise switch shells).","If you control the caller, pre-validate the path with GetShellTypeFromShellPath and handle ShellType_unknown gracefully."],"exampleFix":"// before\n$ SHELL=/usr/bin/tcsh wave\ndetect error: unknown shell type: /usr/bin/tcsh\n// after\n$ chsh -s /bin/zsh && SHELL=/bin/zsh wave","handlingStrategy":"validation","validationCode":"// pre-validate the shell path before calling detection\nshellPath := os.Getenv(\"SHELL\")\nswitch {\ncase strings.Contains(filepath.Base(shellPath), \"bash\"),\n\tstrings.Contains(filepath.Base(shellPath), \"zsh\"),\n\tstrings.Contains(filepath.Base(shellPath), \"fish\"),\n\tstrings.Contains(filepath.Base(shellPath), \"pwsh\"),\n\tstrings.Contains(filepath.Base(shellPath), \"powershell\"):\n\t// supported\ndefault:\n\treturn fmt.Errorf(\"shell %q not supported; use bash/zsh/fish/pwsh\", shellPath)\n}","typeGuard":"func isSupportedShell(shellPath string) bool {\n\treturn shellutil.GetShellTypeFromShellPath(shellPath) != shellutil.ShellType_unknown\n}","tryCatchPattern":"shellType, version, err := shellutil.DetectShellTypeAndVersionFromPath(shellPath)\nif err != nil {\n\tif strings.HasPrefix(err.Error(), \"unknown shell type\") {\n\t\treturn fmt.Errorf(\"%w; falling back to bash\", err)\n\t}\n\treturn err\n}","preventionTips":["Set SHELL to a supported shell (bash/zsh/fish/pwsh) before launching Wave.","Avoid exotic login shells (tcsh, nushell, elvish) or configure a supported shell for terminal blocks.","Check the basename convention: detection matches substrings like 'zsh' or 'pwsh' in the filename.","Guard calls with GetShellTypeFromShellPath and handle ShellType_unknown with a user-facing message."],"tags":["shell-detection","configuration","unsupported-shell"],"backgroundTag":"unsupported-shell-type","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}