This fatal error also occurred to me when I added custom listing/grid. I fixed this issue by changing constructor and initiating correct collection for my data listing/grid in data provider constructor. Example of custom grid DataProvider.php
use Acme\CustomModule\Model\ResourceModel\Entity\Listing\CollectionFactory;
class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
{
public function __construct(
$name,
$primaryFieldName,
$requestFieldName,
CollectionFactory $collectionFactory,
array $meta = [],
array $data = []
) {
parent::__construct($name, $primaryFieldName, $requestFieldName,
$meta, $data);
$this->collection = $collectionFactory->create();
}
public function getData(): array
{
$collection = $this->getCollection();
return $collection->toArray();
}
}
But you need to create \Acme\CustomModule\Model\ResourceModel\Entity\Listing\Collection and follow Raphael at Digital Pianism approachto get it's data in data provider