I am creating console command to input values into the database, there is some argument missing an error. I have gone through several tutorials but to me, the code looks fine. The error is:

Not enough arguments (missing: "Credit, Amount has been credited").

Here is Console Class:

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Vendor\Module\Model\AmountFactory;

class AddItem extends Command
const INPUT_KEY_ACTION = 'Credit';
const INPUT_KEY_REFERENCE = 'Amount has been credited';
//const INPUT_KEY_AMOUNT = 50;

private $amountFactory;

public function __construct(AmountFactory $amountFactory)

  $this->amountFactory = $amountFactory;


protected function configure()

    'Action name'
    'Action Reference'
   //$this->setDescription('Demo console command');

protected function execute(InputInterface $input, OutputInterface $output)
   $amount = $this->amountFactory->create();
   return Cli::RETURN_SUCCESS;

In di.xml:

<type name="Magento\Framework\Console\CommandList">
       <argument name="commands" xsi:type="array">
           <item name="rhinosCredit" xsi:type="object">Vendor\Module\Console\Command\AddItem</item>

When I uncomment lines for third argument i.e Amount I get error

The "50" argument does not exist.

Can somebody help to figure out this error? Thank you

2 Answers 2


Your Argument Names are wrong, they should not be with space. for your case you have used

const INPUT_KEY_REFERENCE = 'Amount has been credited';

it should be like this

const INPUT_KEY_REFERENCE = 'amount_has_been_credited';

ALso in command you need to share the agruments

example:credit:refund ARG1 ARG2

  • I updated, still same: Not enough arguments (missing: "credit, amount_has_been_credited").
    – Ajwad Syed
    Jun 26, 2019 at 9:48
  • Can you please share the command you are trying Jun 26, 2019 at 10:27
  • example:credit:refund
    – Ajwad Syed
    Jun 26, 2019 at 10:57
  • 1
    Sorry to ask but where are the arguments in this command it should be like example:credit:refund ARG1 ARG2 Jun 26, 2019 at 11:11
  • Yes it worked, can you update answer so that I can accept.
    – Ajwad Syed
    Jun 26, 2019 at 11:33

In your configure() function add your argument AMOUNT for amount :

->addArgument(self:: INPUT_KEY_AMOUNT,InputArgument::REQUIRED,'Action Amount');
  • Yes it is added..I missed it while pasting code here.. including this code these errors use to occur
    – Ajwad Syed
    Jun 26, 2019 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.