abpframework/abp · critical · AbpException
Cannot determine shell command for this OS! Running on OS: {
Error message
Cannot determine shell command for this OS! Running on OS: {System.Runtime.InteropServices.RuntimeInformation.OSDescription} | OS Architecture: {System.Runtime.InteropServices.RuntimeInformation.OSArchitecture} | Framework: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription} | Process Architecture{System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture} What it means
Thrown by CmdHelper.GetFileName() when the CLI needs to launch a shell process but the current OS is not Windows and neither /bin/bash nor /bin/sh exists on disk. This AbpException includes OS/architecture/framework details to aid diagnosis. It is a hard environment-compatibility failure: the CLI cannot run npm/other shell commands without a shell binary.
Source
Thrown at framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Utils/CmdHelper.cs:207
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
//Windows
return "cmd.exe";
}
//Linux or OSX
if (File.Exists("/bin/bash"))
{
return "/bin/bash";
}
if (File.Exists("/bin/sh"))
{
return "/bin/sh"; //some Linux distributions like Alpine doesn't have bash
}
throw new AbpException($"Cannot determine shell command for this OS! " +
$"Running on OS: {System.Runtime.InteropServices.RuntimeInformation.OSDescription} | " +
$"OS Architecture: {System.Runtime.InteropServices.RuntimeInformation.OSArchitecture} | " +
$"Framework: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription} | " +
$"Process Architecture{System.Runtime.InteropServices.RuntimeInformation.ProcessArchitecture}");
}
private void HideNewCommandWindow(ProcessStartInfo procStartInfo)
{
procStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
procStartInfo.CreateNoWindow = true;
}
}
View on GitHub (pinned to 7ed43b1931)
Solutions
- Install or expose a shell: add bash (apk add bash / apt-get install bash) or ensure /bin/sh exists; symlink /usr/bin/sh to /bin/sh if needed.
- If using a minimal base image, switch to one that ships a POSIX shell (e.g. debian-slim instead of a from-scratch image).
- Verify RuntimeInformation.IsOSPlatform(OSPlatform.Windows) is not being incorrectly skipped; on true Windows this branch should never run.
- Avoid invoking CLI commands that require npm/yarn in the stripped environment, or pre-build the assets where a shell is available.
Example fix
// before — running in a from-scratch/alpine image without bash // after — in the Dockerfile RUN apk add --no-cache bash # or ensure /bin/sh exists: alpine ships busybox ash at /bin/sh by default, # so confirm the path rather than relying on /usr/bin/sh
Defensive patterns
Strategy: validation
Validate before calling
// Pre-flight shell availability check (non-Windows) before running CLI subcommands
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
if (!File.Exists("/bin/bash") && !File.Exists("/bin/sh"))
throw new InvalidOperationException("No shell found at /bin/bash or /bin/sh; install bash or link sh.");
} Prevention
- Base CLI images on debian-slim or alpine+bash so a shell is always present.
- In Dockerfiles, RUN apk add bash or apt-get install bash before invoking the CLI.
- Keep CLI invocations that shell out to npm on hosts where /bin/sh exists.
When it happens
Trigger: Running the ABP CLI (which shells out to npm/yarn/dotnet) on a non-Windows, non-OSX system where both /bin/bash and /bin/sh are absent — e.g. a heavily stripped container or an unusual Unix where the POSIX shell lives elsewhere (e.g. /usr/bin/sh only).
Common situations: Minimal Docker images that lack bash and link sh at a non-standard path; chroot/sandbox environments without a shell bind-mounted in; running under a custom .NET runtime host that misreports the OS so the Windows branch is skipped.
Related errors
- Cannot determine operating system!
- Cannot determine runtime platform!
- AES-GCM is not available on .NET Standard 2.0!
- DbMigrations folder path is missing!
- DbMigrator is not found!
AI-assisted analysis of abpframework/abp@7ed43b1931 (2026-08-13).
Data as JSON: /api/errors/9ba6f76c5b9f001e.
Report an issue: GitHub.