felixse/FluentTerminal · error · Exception

'${command}' command not found. Error message: ${error}

Error message

'${command}' command not found. Error message: ${error}

What it means

Thrown by FileFinder.GetCommandPath when the Windows `where` utility (used to resolve an executable on PATH) exits non-zero AND writes an error message. The helper shells `where <command>`, captures stdout/stderr; on failure with a non-empty error line it reports the command was not found along with where's error text.

Source

Thrown at FluentTerminal.SystemTray/FileFinder.cs:84

                    if (process.ExitCode == 0)
                    {
                        if (string.IsNullOrEmpty(path))
                        {
                            throw new Exception("Should not happen! 'where' exit code is 0, yet the path is empty.");
                        }

                        if (!File.Exists(path))
                        {
                            throw new Exception(
                                "Should not happen! 'where' returned a path that doesn't exist: " + path);
                        }

                        return path;
                    }

                    if (!string.IsNullOrEmpty(error))
                    {
                        throw new Exception($"'{command}' command not found. Error message: " + error);
                    }

                    throw new Exception($"'{command}' command not found. Exit code: {process.ExitCode:##########}");
                }
            }
        }
    }
}

View on GitHub (pinned to ba83ec485e)

Solutions

  1. Install the missing tool and ensure its directory is on the system PATH (restart the app/tray so it inherits the new PATH).
  2. Point the profile's shell Location directly at the executable's full path instead of relying on PATH lookup.
  3. Verify the tool is installed for the same user/architecture the tray process runs under.

Example fix

// before
if (!string.IsNullOrEmpty(error))
    throw new Exception($"'{command}' command not found. Error message: " + error);

// after - actionable hint pointing the user to install/PATH
throw new Exception($"'{command}' was not found on PATH ({error}). Install it or set the full path in the profile.");
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the path yourself and fall back to a configured location.
string full = null;
foreach (var dir in Environment.GetEnvironmentVariable("PATH").Split(Path.PathSeparator))
    foreach (var ext in new[]{".exe",".bat",".cmd"})
        if (File.Exists(Path.Combine(dir, command + ext))) { full = Path.Combine(dir, command + ext); break; }
if (full == null) throw new FileNotFoundException($"'{command}' not found on PATH", command);

Try / catch

try { path = command.GetCommandPath(); }
catch (Exception ex) { logger.Warn(ex, "command not found"); promptUserForPath(command); }

Prevention

When it happens

Trigger: GetCommandPath("bash") (or wsl, mosh, ssh, etc.) runs `where bash`; the executable is not on PATH so where prints 'INFO: Could not find files for the given pattern(s).' and exits non-zero, triggering this branch.

Common situations: Requested shell/tool (bash.exe, wsl.exe, git, mosh) is not installed or not on the system PATH; PATH was modified after the app started; the tool is installed only for a different user; running on a system where the dependency was never installed.

Related errors


AI-assisted analysis of felixse/FluentTerminal@ba83ec485e (2026-08-13). Data as JSON: /api/errors/004c10607c12cece. Report an issue: GitHub.