[3.13.4] - [RuntimeException] - Not enough arguments

Hey there,
updated to 3.13.4 Version and got this Error Mail tonight … ?

Cron apache@stats /usr/bin/php /var/www/piwik/console database:optimize-archive-tables > /var/log/piwik.cron.log

ERROR [2020-04-01 04:15:01] 13420 Uncaught exception: /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Input/Input.php(77): Not enough arguments.
Not enough arguments.
#0 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(252): Symfony\Component\Console\Input\Input->validate()
#1 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreAdminHome\Commands\OptimizeArchiveTables), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/piwik/core/Console.php(140): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/piwik/core/Access.php(644): Piwik\Console->Piwik{closure}()
#6 /var/www/piwik/core/Console.php(141): Piwik\Access::doAsSuperUser(Object(Closure))
#7 /var/www/piwik/core/Console.php(93): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/piwik/console(32): Symfony\Component\Console\Application->run()
#10 {main}

[RuntimeException]
Not enough arguments.

database:optimize-archive-tables [–dry-run] dates1 … [datesN]

What’s wrong here?

thx, bye from Austria
Andreas

Hi,

That’s a weird one.
The OptimizeArchiveTables.php has not been touched since last summer, so there are no new undocumented command line parameters required.

My tip would be to edit the /var/www/piwik/vendor/symfony/console/Symfony/Component/Console/Input/Input.php and var_dump the arguments to get a clue why there are too few.

    /**
     * Validates the input.
     *
     * @throws \RuntimeException When not enough arguments are given
     */
    public function validate()
    {
        if (count($this->arguments) < $this->definition->getArgumentRequiredCount()) {
            throw new \RuntimeException('Not enough arguments.');
        }
    }

I seem to attract those weird ones … :man_facepalming:t2:

var_dump() of $this->arguments

-bash-4.2$ /usr/bin/php /var/www/piwik/console database:optimize-archive-tables                          
Arg: array(1) {
  ["command"]=>
  string(32) "database:optimize-archive-tables"
}

Hi,

Okay, it seems like the same happens when I try it.

Adding a var_dump($this->definition->getArguments()); indicates that two arguments would be expected.

And checking

there is indeed a required parameter called dates which is also confirmed by console database:optimize-archive-tables --help.

As this required parameter exists since 5 years ago, running this command without specifying a date couldn’t have been working before.

Hey @Lukas,
you see me quite baffled I haven’t noticed yet that the Cron was not working properly …
Seems like I added the Cronjob on 16.11.2018 on advise by tsteur - but I just can’t figure out why I never realised it’s not working as expected as I normally dripple check everything … :grimacing::man_facepalming:t2:

Well … thank you, as so often, very much! :wink:

Bye out of Quarantine in sunny Tirol
Andreas

1 Like

Hi,

Tip for the future:
add a

MAILTO="me@example.com"

line at the beginning of the the crontab file to get E-Mail notifications of failures (if a mailserver is set up).

Stay save and greetings from the other end of Austria!

1 Like

I have the same problem here. What is the solution now for this problem?

@rittershofer

The solution is to call console with the correct paramters as indicated by --help. In the case of database:optimize-archive-tables you need to specify at least one date.

Problem solved - unclear help page. Thanks anyway.