Support

Akeeba Backup for Joomla!

#41472 Cron job error: InvalidArgumentException {#621

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
5.x
PHP version
8.2
Akeeba Backup version
Latest

Latest post by nicholas on Tuesday, 14 January 2025 02:09 CST

5uwebsite

It is strange. We setup this website like others on the same server, and only this cannot run with the following error

 

Cron Daemon <[email protected]>
6:10 PM (5 minutes ago)
to me

InvalidArgumentException {#621
#message: "A router name must be set in console application."
#code: 0
#file: "./www/example.com/public_html/libraries/src/Application/ConsoleApplication.php"
#line: 484
trace: {
./www/example.com/public_html/libraries/src/Application/ConsoleApplication.php:484 {
Joomla\CMS\Application\ConsoleApplication::getRouter($name = null, array $options = [])
› if (empty($name)) {
› throw new \InvalidArgumentException('A router name must be set in console application.');

5uwebsite

It seems that the error has a Chinese Character and maybe that is the reason?

 

I tried to uninstall Akeeba Backup Pro and re-installed with the latest version, the run the wizard again but still no luck. It seems working for running it at the backend, but not working when run via cron job:

/usr/bin/php /home/customer/www/example.com/public_html/cli/joomla.php akeeba:backup:take --profile=2

 

 

      Joomla\CMS\Application\ConsoleApplication::getRouter($name = null, array $options = [])

      鈥?if (empty($name)) {

      鈥?    throw new \InvalidArgumentException('A router name must be set in console application.');

      鈥?}

nicholas
Akeeba Staff
Manager

The error comes from a third party plugin, not our software. A third party plugin is trying to do $app->getRouter() under the Joomla! Console (CLI) Application. However, this cannot work. Hence the error. If you paste the rest of the error message we can find the third party plugin which causes that issue.

The “Chinese character” is a red herring. It's Symphony Console (the third party library used by Joomla for the Joomla CLI) is trying to display colored text using standard escape codes. Software which does not understand them tends to print them as garbage. That's what you got. It has nothing to do with the issue at hand.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

5uwebsite

Hi Nicholas,

 

Thank you for your always fast and informative reply! The support from you is always helpful and this really give people faith about everything your team developed.

 

This is the full email I got whenever the cron job is run:


InvalidArgumentException {#621
#message: "A router name must be set in console application."
#code: 0
#file: "./www/example.com/public_html/libraries/src/Application/ConsoleApplication.php"
#line: 484
trace: {
./www/example.com/public_html/libraries/src/Application/ConsoleApplication.php:484 {
Joomla\CMS\Application\ConsoleApplication::getRouter($name = null, array $options = [])
鈥?if (empty($name)) {
鈥? throw new \InvalidArgumentException('A router name must be set in console application.');
鈥?}
}
./www/example.com/public_html/plugins/system/jmap/jmap.php:1284 { 鈥
./www/example.com/public_html/libraries/src/Extension/ExtensionManagerTrait.php:242 { 鈥
./www/example.com/public_html/libraries/src/Extension/ExtensionManagerTrait.php:160 { 鈥
./www/example.com/public_html/libraries/src/Extension/ExtensionManagerTrait.php:99 { 鈥
./www/example.com/public_html/libraries/src/Plugin/PluginHelper.php:232 { 鈥
./www/example.com/public_html/libraries/src/Plugin/PluginHelper.php:192 { 鈥
./www/example.com/public_html/libraries/src/Application/ConsoleApplication.php:252 { 鈥
./www/example.com/public_html/cli/joomla.php:77 { 鈥
}
}

 

Do you need anything else to find the cause?

 

Thank you.

 

5uwebsite

Actually your reply was so helpful that, I already resolved the problem!

 

A line said "jmap" has the problem. That must be jSiteMap. So I disabled it, updated that plugin and run the cron job again. Problem solved!

 

You are always great! Have never seen a support better than you!

5uwebsite

This actually makes me thought about one of your comment about Joomla 4. The Joomla team had never talked to developers like you and changed how the cron job was run. I believe they put everything together, rather than let the cron job to directly run for each application. Now if any one of them failed, it could affect the others, although we never set a cron job for it. 

 

I think it is a problem in the long run, because you never know when a plugin could fail the cron job for other extensions. Like jSiteMap, it was always running fine, but maybe a specific version caused the problem. 

 

Anyway, thanks again!

nicholas
Akeeba Staff
Manager

Actually, the decision to make a Joomla! 4 CLI application was something that us third party developers were asking of Joomla! for the longest time – I'm talking about a decade before it was finally implemented.

Joomla! did it the right way by using the Symphony Console package to implement it; this is the standard PHP way to create CLI applications.

Joomla! implemented it since the early 4.0 alphas, and they did ask those of us with CLI scripts in our software to test it and provide feedback. I can attest that I was one very happy camper, and have enthusiastically embraced it. The CLI application solved a ton of problems we've had in the past, even with Joomla! 3 providing a fairly solid JApplicationCli class which allowed us to write CLI utilities for Joomla! sites. Having everything controlled by a plugin, using Symphony Console commands, with a PSR-4 autoloader, while having a full Joomla! runtime available has been a godsend. We could remove a lot of very hard to test code, chockfull of nested if-blocks which tried to accommodate for the differences between Joomla! versions.

But that's irrelevant.

The actual problem you had is that the plugin author has not been following the best practices to avoid breaking Joomla!, practices which have been around for well over a decade (and some for almost two decades) as I explained all of that back in June 2022. You can't blame Joomla! for that. You should get in contact with that developer letting them know their plugin breaks Joomla's CLI application, and point them to my blog post so they can fix their software.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

5uwebsite

Thanks a lot for the detailed and clear instructions!

nicholas
Akeeba Staff
Manager

You're welcome! If you or the plugin developer have any questions you can reach me here, or via the contact form on my blog. I am happy to provide information and assistance to third party developers to improve the Joomla! experience for all Joomla! users.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!