diff --git a/aider/commands.py b/aider/commands.py index 341499fdf..e2de8959a 100644 --- a/aider/commands.py +++ b/aider/commands.py @@ -1309,8 +1309,12 @@ class Commands: continue self.io.tool_output(f"\nExecuting: {cmd}") - # catch switchcoder exception and print error that cmd is only supported with interactive /commands ai! - self.run(cmd) + try: + self.run(cmd) + except SwitchCoder: + self.io.tool_error( + f"Command '{cmd}' is only supported in interactive mode, skipping." + ) def completions_raw_save(self, document, complete_event): return self.completions_raw_read_only(document, complete_event)