Execute Shell Script with no results returns an error

I think your beef is with grep, rather than Keyboard Maestro.

On my Mac, man grep lists the exit codes as:

EXIT STATUS
     The grep utility exits with one of the following values:

     0     One or more lines were selected.
     1     No lines were selected.
     >1    An error occurred.

Demo:

❯ echo foo | grep foo ; echo $?
foo
0
❯ echo foo | grep bar ; echo $?
1

This contradicts the Unix convention of using zero for normal exit and non-zero for abnormal.

For its own purposes, grep doesn't consider it an error to have no matches, which is why it doesn't emit a message. It is trying to signal to a calling program, through its exit code, that it ran successfully, but found no matches.

It's reasonable for a generic tool running on a POSIX platform (KM) to assume applications will follow the conventions of the platform. Grep isn't doing that, which is why you're seeing the behavior you're seeing. (If you happen to have your shell configured to highlight failed commands (e.g. with Starship), it probably will in fact treat a no-match grep as "failed.")

If you want to make a macro that acts differently based on grep's exit code, you could use the technique described here.