Command fails in script but runs properly in the terminal

The router is an RB1100Dx4 running RouterOS 7.15.3, the latest available.
I’m running a command which uses ssh to connect to a container without password (by using keys). The command runs as expected as long as it is executed manually in a terminal but it fails to run in a script with the following message sent to the log:

executing script test1 from winbox failed, please check it manually

While triyng to isolate the issue I reduced the script to only one line which also fails:

/system/ssh address=172.17.0.2 user=root command=“/test.sh”

I also created another script (test2) with the following contents:

:log info message=“11111”
/system/ssh address=172.17.0.2 user=root command=“cat /test.out”
:log info message=“22222”

Whe I run this new script I see the string “11111” written to the log and inmediately after, there is the message:
executing script test1 from winbox failed, please check it manually

the line after the problematic command (22222) is never written.
It also fails from Webmin, Webfig and the scheduler.

Permissions have been changed including checking "“Don’t require permissions”
Current user is admin, I also tried with a different user with full permissions without success.

Please advise,
Thanks in advance

Is already false at the start: The latest available is 7.16.1, what you write?

I said what is visible for this router in /system/RouterBOARD
Current firmware: 7.15.3
Upgrade firmware: 7.15.3

https://mega.nz/file/7fhBHAyL#sjnRWCAxZmf2KAdKmTcVUj8FsEwUajXG0t1bKFC1qDs

This is the “BIOS” vesion… not the OS… (/system/package)

You are right. thanks for pointing that out.
Now I have upgraded RouterOS to the latest version:

[admin@MikroTik] > /system/package/print
Columns: NAME, VERSION, BUILD-TIME, SIZE

NAME VERSION BUILD-TIME SIZE

0 dude 7.16.1 2024-10-10 14:03:32 1288.1KiB
1 container 7.16.1 2024-10-10 14:03:32 96.1KiB
2 routeros 7.16.1 2024-10-10 14:03:32 11.1MiB
3 wireless 7.16.1 2024-10-10 14:03:32 1924.1KiB

Unfortunately the problem remains the same so the script works in the terminal and fails in Webmin, Webfig and the Scheduler.

Use ssh-exec instead ssh command, ssh requires CLI (Terminal).
Regarding script errors, you can always catch script error with :onerror and log it to find exact message for debugging since standard error message “executing script ssh from winbox failed, please check it manually” is not very descriptive, for eg.:

:onerror e in={
  /system/ssh address=172.17.0.2 user=root command="/test.sh"
} do={
  :log error $e
}

In log it will be logged: “Script Error: action cancelled. Terminal is not prompting.”

From this message you will probably conclude that command requires Terminal…

Good point. ssh-exec works!!
Problem solved.
And the error capture code is a nice tip to have in mind.
Thank you so much.
Regards