Skip to content

[4.x]: An error occurred when duplicating the element. #16214

@duxabilii

Description

@duxabilii

What happened?

Description

Unable to duplicate entry with Asset field inside Martix Block

Steps to reproduce

  1. Create Section with type Structure
  2. Add entry on the third level of structure
  3. For the third-level entry add Matrix Field with Asset Field
  4. Set Asset Location to {owner.parent.parent.slug}
  5. Create entry on the third-level of structure
  6. Add asset to Matrix Block and save Entry.
  7. Click on the Save as New Entry button

Expected behavior

New entry created from existing

Actual behavior

Exception: An error occurred when duplicating the element.

HTTP 500 – Internal Server Error – yii\web\ServerErrorHttpException
An error occurred when duplicating the element.

Caused by: Invalid subpath – craft\errors\InvalidSubpathException
The Asset field’s Asset Location setting has an invalid subpath (“{owner.parent.parent.slug}”).

in /craft/vendor/craftcms/cms/src/fields/Assets.php at line 1072

Caused by: Invalid subpath – craft\errors\InvalidSubpathException
Could not resolve the subpath “{owner.parent.parent.slug}”.

in /craft/vendor/craftcms/cms/src/fields/Assets.php at line 951

Image

Craft CMS version

Craft Pro from 4.10.6 to 4.13.3

PHP version

8.1.20

Operating system and version

Docker image craftcms/php-fpm:8.1

Database type and version

PostgreSQL 15.5

Image driver and version

GD 8.1.20

Installed plugins and versions

  • Amazon S3 2.2.1
  • Audit 3.0.3
  • CKEditor 3.8.3
  • Imager X 4.4.1
  • Logs 4.0.1
  • Read-only Field 2.0.1
  • Schedule 0.6.2
  • Shortcodes 3.0.0
  • Smith 2.0.1
  • Super Table 3.0.14
  • Translations 4.0.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions