Hackcat

What to Do If the Same Command Runs Locally but Shows Syntax Errors in Agent?

First confirm the shell actually used by Agent, then correct parameters, quoting, and paths.

The Execution Entry May Use a Different Shell

Do not judge Agent's shell solely based on the operating system or the terminal you open manually. On Windows, both desktop and CLI implementations prioritize Git Bash; if not found, they use cmd; it is not fixed to PowerShell. Unix desktops choose the user's available shell on the host, while CLI uses bash for ordinary command paths. Changing the entry point may alter how the same string is interpreted.

First Check Paths and Quoting Methods

Have Agent first confirm the actual shell, then handle paths containing spaces, URLs with question marks or connectors, and platform-specific parameter syntax. Some shells treat unquoted characters as wildcards, causing errors that look like files not found. Do not just modify one suspicious character and continue batch execution; you can first split the task into a single verifiable read-only command to observe the result.

Distinguish Syntax Issues from Missing Tools

If the error is 'program not found,' first check tool installation and paths; if access is denied, check system permissions; only parsing errors require focusing on correcting shell syntax. Even if the last part of the command shows success, check earlier error outputs to avoid ignoring partial failures. Confirm single-step behavior is correct before restoring the full task; there is no need to reset connection tokens or raise client permissions by default for this.