Magento 2: Error filtering template: Notice: Undefined index url

This error is affecting the homepage after I changed the src=”” attribute in image tag.

“Error filtering template: Notice: Undefined index: url in
[root]/vendor/magento/module-widget/Model/Template/Filter.php on line
145”

<?php

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

namespace MagentoWidgetModelTemplate;

/**
 * Template Filter Model
 * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
 */
class Filter extends MagentoCmsModelTemplateFilter
{
    /**
     * @var MagentoWidgetModelResourceModelWidget
     */
    protected $_widgetResource;

    /**
     * @var MagentoWidgetModelWidget
     */
    protected $_widget;

    /**
     * @param MagentoFrameworkStdlibStringUtils $string
     * @param PsrLogLoggerInterface $logger
     * @param MagentoFrameworkEscaper $escaper
     * @param MagentoFrameworkViewAssetRepository $assetRepo
     * @param MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig
     * @param MagentoVariableModelVariableFactory $coreVariableFactory
     * @param MagentoStoreModelStoreManagerInterface $storeManager
     * @param MagentoFrameworkViewLayoutInterface $layout
     * @param MagentoFrameworkViewLayoutFactory $layoutFactory
     * @param MagentoFrameworkAppState $appState
     * @param MagentoFrameworkUrlInterface $urlModel
     * @param PelagoEmogrifier $emogrifier
     * @param MagentoVariableModelSourceVariables $configVariables
     * @param MagentoWidgetModelResourceModelWidget $widgetResource
     * @param MagentoWidgetModelWidget $widget
     * @SuppressWarnings(PHPMD.ExcessiveParameterList)
     */
    public function __construct(
        MagentoFrameworkStdlibStringUtils $string,
        PsrLogLoggerInterface $logger,
        MagentoFrameworkEscaper $escaper,
        MagentoFrameworkViewAssetRepository $assetRepo,
        MagentoFrameworkAppConfigScopeConfigInterface $scopeConfig,
        MagentoVariableModelVariableFactory $coreVariableFactory,
        MagentoStoreModelStoreManagerInterface $storeManager,
        MagentoFrameworkViewLayoutInterface $layout,
        MagentoFrameworkViewLayoutFactory $layoutFactory,
        MagentoFrameworkAppState $appState,
        MagentoFrameworkUrlInterface $urlModel,
        PelagoEmogrifier $emogrifier,
        MagentoVariableModelSourceVariables $configVariables,
        MagentoWidgetModelResourceModelWidget $widgetResource,
        MagentoWidgetModelWidget $widget
    ) {
        $this->_widgetResource = $widgetResource;
        $this->_widget = $widget;
        parent::__construct(
            $string,
            $logger,
            $escaper,
            $assetRepo,
            $scopeConfig,
            $coreVariableFactory,
            $storeManager,
            $layout,
            $layoutFactory,
            $appState,
            $urlModel,
            $emogrifier,
            $configVariables
        );
    }

    /**
     * General method for generate widget
     *
     * @param string[] $construction
     * @return string
     */
    public function generateWidget($construction)
    {
        $params = $this->getParameters($construction[2]);

        // Determine what name block should have in layout
        $name = null;
        if (isset($params['name'])) {
            $name = $params['name'];
        }

        if (isset($this->_storeId) && !isset($params['store_id'])) {
            $params['store_id'] = $this->_storeId;
        }

        // validate required parameter type or id
        if (!empty($params['type'])) {
            $type = $params['type'];
        } elseif (!empty($params['id'])) {
            $preConfigured = $this->_widgetResource->loadPreconfiguredWidget($params['id']);
            $type = $preConfigured['widget_type'];
            $params = $preConfigured['parameters'];
        } else {
            return '';
        }

        // we have no other way to avoid fatal errors for type like 'cms/widget__link', '_cms/widget_link' etc.
        $xml = $this->_widget->getWidgetByClassType($type);
        if ($xml === null) {
            return '';
        }

        // define widget block and check the type is instance of Widget Interface
        $widget = $this->_layout->createBlock($type, $name, ['data' => $params]);
        if (!$widget instanceof MagentoWidgetBlockBlockInterface) {
            return '';
        }

        return $widget->toHtml();
    }

    /**
     * Generate widget
     *
     * @param string[] $construction
     * @return string
     */
    public function widgetDirective($construction)
    {
        return $this->generateWidget($construction);
    }

    /**
     * Retrieve media file URL directive
     *
     * @param string[] $construction
     * @return string
     */
    public function mediaDirective($construction)
    {
        $params = $this->getParameters(html_entity_decode($construction[2], ENT_QUOTES));
        return $this->_storeManager->getStore()
            ->getBaseUrl(MagentoFrameworkUrlInterface::URL_TYPE_MEDIA) . $params['url'];
    }
}
 

I tried using the problems tab on Vscode, if solution is found, please explain which error lead to solution.