can1357/oh-my-pi · error · Error

Unsupported shell${shell ? ` "${shell}"` : ""}. Supported sh

Error message

Unsupported shell${shell ? ` "${shell}"` : ""}. Supported shells: bash, zsh, fish, PowerShell.

What it means

normalizeShellName cannot map the provided shell to a supported profile generator. Supported values are bash, zsh, fish, pwsh, and powershell; on Windows with no explicit shell it auto-detects the PowerShell edition. When the value is missing entirely the message omits the quoted name.

Source

Thrown at packages/coding-agent/src/cli/profile-alias.ts:196

	return "powershell";
}

function normalizeShellName(
	shellPath: string | undefined,
	platform: NodeJS.Platform,
	env: NodeJS.ProcessEnv,
): ProfileAliasShell {
	const shell = path
		.basename(shellPath ?? "")
		.toLowerCase()
		.replace(/\.exe$/, "");
	if (shell === "zsh") return "zsh";
	if (shell === "bash") return "bash";
	if (shell === "fish") return "fish";
	if (shell === "pwsh") return "pwsh";
	if (shell === "powershell") return "powershell";
	if (platform === "win32") return detectWindowsPowerShell(env);
	throw new Error(`Unsupported shell${shell ? ` "${shell}"` : ""}. Supported shells: bash, zsh, fish, PowerShell.`);
}

/** Resolve the command a generated profile alias should invoke. */
export function resolveProfileAliasCommandFromProcess({
	argv = process.argv,
	cwd = process.cwd(),
	compiled = process.env.PI_COMPILED === "true",
}: ProfileAliasProcessOptions = {}): ProfileAliasCommand {
	if (compiled) return DEFAULT_ALIAS_COMMAND;

	const runtime = argv[0];
	const script = argv[1];
	if (!runtime || !script || !/\.[cm]?[jt]s$/.test(script)) return DEFAULT_ALIAS_COMMAND;

	const scriptPath = path.resolve(cwd, script);
	// Normalize to forward slashes for POSIX shell fields — bash/zsh/fish
	// can't resolve backslash-separated paths, even on Windows (Git Bash, WSL).
	const posixScriptPath = scriptPath.replace(/\\/g, "/");

View on GitHub (pinned to 9690622007)

Solutions

  1. Pass an explicit supported shell via the shell option, e.g. `--shell bash` / zsh / fish / pwsh / powershell
  2. Install or point $SHELL at a supported shell before running --alias
  3. On Windows, rely on auto-detection by not overriding the shell, or explicitly use pwsh/powershell
  4. Manually append the generated alias block to your shell config if your shell is genuinely unsupported

Example fix

// before (SHELL=/usr/bin/fish-like nu)
omp --profile work --alias work
// after
omp --profile work --alias work --shell bash
Defensive patterns

Strategy: fallback

Validate before calling

const SUPPORTED = new Set(["bash", "zsh", "fish", "pwsh", "powershell"]);
const shell = (shellPath ?? process.env.SHELL ?? "").split("/").pop() ?? "";
if (!SUPPORTED.has(shell) && process.platform !== "win32") {
  throw new Error(`Shell "${shell}" unsupported; pass --shell bash|zsh|fish|pwsh|powershell`);
}

Type guard

function isSupportedShell(name: string | undefined): boolean {
  return !!name && ["bash", "zsh", "fish", "pwsh", "powershell"].includes(name.toLowerCase());
}

Try / catch

try {
  await installProfileAlias(options);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Unsupported shell")) {
    // fall back to manual instructions or a supported default
    console.error(`${err.message}\nAppending the alias block manually to your shell config instead.`);
    return;
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling installProfileAlias with --shellPath or $SHELL set to an unsupported shell (e.g. /bin/dash, /usr/bin/nu, cmd.exe), or a non-Windows environment where SHELL is unset/empty and no shell override is provided.

Common situations: Users on exotic shells (nushell, elvish, tcsh) or minimal containers/dockers where $SHELL is not exported; Windows users whose SHELL points at a POSIX shell not in the list.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/4a86151d192a59dd. Report an issue: GitHub.