Magento – Uncaught TypeError: Argument 1 passed to Symfony\Component\Console\Helper\ProgressBar::setFormat() must be of the type string, null given

magento2-migration-toolmagento2.3php-7.2ssh

When i trying to install data migration tool then getting this error in SSH

PHP Fatal error: Uncaught TypeError: Argument 1 passed to
Symfony\Component\Console\Helper\ProgressBar::setFormat() must be of
the type string, null given, called in
/var/www/html/xyz/vendor/magento/data-migration-tool/src/Migration/App/ProgressBar/LogLevelProcessor.php
on line 88 and defined in
/var/www/html/xyz/vendor/symfony/console/Helper/ProgressBar.php:230

Best Answer

I had just the same issue recently, while migrating from 1.9.1.0 to 2.3.0 The problem is that method getProgressBar trying to get option progress_bar_format from config.xml under your Magento1 version's folder (in my case this is /vendor/magento/data-migration-tool/etc/opensource-to-opensource/1.9.1.0/config.xml) to create progress bar that you can see while migration process in console.

/vendor/magento/data-migration-tool/src/Migration/App/ProgressBar/LogLevelProcessor.php

protected function getProgressBar()
{
    if (null == $this->progressBar) {
        $this->progressBar = $this->progressBarFactory->create($this->getOutputInstance());
        $this->progressBar->setFormat($this->config->getOption(self::PROGRESS_BAR_FORMAT_OPTION));
    }
    return $this->progressBar;
}

But method $this->config->getOption(self::PROGRESS_BAR_FORMAT_OPTION)); didn't get option and returned null, that's because:

/vendor/magento/data-migration-tool/src/Migration/Config.php

public function getOption($name)
{
    return isset($this->options[$name]) ? $this->options[$name] : null; <-- '' instead of null
}

So i just replaced null to empty strig '', to get default progress bar. And it helped.

Related Topic