Preconditions (*)

  1. PHP 7.4.27
  2. composer 2.1.4
  3. Magento version 2.4.2-p2 enterprise
  4. Elasticsearch 7.16.2
  5. Redis Cache 5.0.14
  6. Grunt 1.0.4

Steps to reproduce (*)

  1. Install a fresh installation of Magento with multiple store views (3-4), and added my custom code for the website
  2. Try to access the homepage

Expected result (*)

  1. Site should load the default homepage

Actual result (*)

  1. Site displays error saying URI is not valid and cannot be converted into a string image image

2 Answers 2


This will be thrown if you for example have a redirected result set up, and the URL for it is not set correctly.

For example:

$redirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
$redirect->setUrl('a/b/c'); // this is missing = PROBLEM
return $redirect;

Go to the database, table core_config_data, and check the following:

  1. do you have an entry with path default and value NULL? Delete that
  2. does your base_url have any weird characters, for example a newline at the end?

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.