Skip to content

craft\helpers\Cp::elementChipHtml(): Argument #1 ($element) must be of type craft\base\ElementInterface, null given error when feed mapping reference an default asset which is deleted #1692

@jamesmacwhite

Description

@jamesmacwhite

Description

If you have a feed with a field mapping that references an asset as a default value for an asset field. If you delete the referenced default asset it causes the following error when loading the feed mapping page:

craft\helpers\Cp::elementChipHtml(): Argument #1 ($element) must be of type craft\base\ElementInterface, null given

This causes the Feed Me field mapping CP path to throw a Server Error, meaning you cannot edit the field mapping data through the CP anymore.

In order to fix this, I had a do a DB migration which modified the fieldMapping column to remove the default asset ID data, so it could be edited again resaved to update the data properly.

Steps to reproduce

  1. Serup a feed which has an asset field
  2. Set a default asset in the feed
  3. Delete the asset
  4. Load the feed mapping and get a Server Error.

Additional info

  • Craft version: 5.8.18
  • PHP version: 8.3
  • Database driver & version: MySQL 8.0.40
  • Plugins & versions:

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions