InvalidArgumentException: The allowed types parameter is required and must be an array of strings. in Drupal\media_library\MediaLibraryState->validateRequiredParameters() (line 150 of core/modules/media_library/src/MediaLibraryState.php).

Created on 4 July 2024, 2 months ago
Updated 27 August 2024, 12 days ago

Problem/Motivation

"The website encountered an unexpected error. Try again later.

InvalidArgumentException: The allowed types parameter is required and must be an array of strings. in Drupal\media_library\MediaLibraryState->validateRequiredParameters() (line 150 of core/modules/media_library/src/MediaLibraryState.php)."

Sharing SS:

After Deleting all Media types, I am getting this error on the home page & content page as an admin, except for admin pages...

Steps to reproduce

Platform D10.2.7, MySQL - 5.8, PHP- 8.3

1. Add an image media type field in any content type. (don't make it required)
2. Change field formatter to rendered entity from manage display
3. Select media library from format settings of the filed (using manage display)
4. Create some nodes of the content type (without filling the media field)
5. Now, delete all media types from admin>structure>media.
6. Go back to the content pages.

Proposed resolution

Fix the issue in validateRequiredParameters()

๐Ÿ› Bug report
Status

Postponed: needs info

Version

11.0 ๐Ÿ”ฅ

Component
Mediaย  โ†’

Last updated less than a minute ago

Created by

๐Ÿ‡ฎ๐Ÿ‡ณIndia Sourav_Paul Kolkata

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Sourav_Paul
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sourav_Paul Kolkata
  • ๐Ÿ‡ณ๐Ÿ‡ฟNew Zealand quietone New Zealand

    Fixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies. Also, 10.2 is in security mode now.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen

    Does this bug require the sitestudio_page_builder module to reproduce? It is installed on that site. Itโ€™s in the stack trace. But itโ€™s not in the steps to reproduce.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sourav_Paul Kolkata

    @cilefen site studio is not required to reproduce the issue....

  • Status changed to Postponed: needs info 2 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen

    I can't reproduce this by building a reference site on https://simplytest.me so the steps to reproduce this need refining.

  • Issue was unassigned.
  • Status changed to Active 2 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sourav_Paul Kolkata
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia Sourav_Paul Kolkata
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia sarwan

    sarwan_verma โ†’ made their first commit to this issueโ€™s fork.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia VinmayiSwamy

    Hi, I followed the steps outlined in the issue summary to reproduce this issue in Drupal 10.2.8-dev (cloned from 10.2.x), using MySQL 5.7 (as MySQL 5.8 is unsupported in DDEV for arm64 architecture. Please see the error below for reference) and PHP 8.3.

    $ ddev config --database=mysql:5.8
    You are reconfiguring the project at /Users/vinmayi.nidubrolu/projects/drupal102x/drupal.
    The existing configuration will be updated and replaced.
    Configuring a 'drupal' project named 'drupal102x' with docroot '' at '/Users/vinmayi.nidubrolu/projects/drupal102x/drupal'.
    For full details use 'ddev describe'.
    failed to validate config: the drupal102x project has an unsupported database type/version: 'mysql:5.8', DDEV arm64 only supports the following database types and versions: mariadb: [10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.11], mysql: [5.7 8.0], postgres: [9 10 11 12 13 14 15 16]
    

    However, I am not able to reproduce the issue.

    After deleting all media types as described, I revisited the nodes created with the content type that included the media field. The nodes rendered without any issues, and there were no relevant entries in the "Recent log messages."

    Additionally, I checked the same scenario in Drupal 11.x with PHP 8.3 and MariaDB 10.11, and I still couldn't reproduce the issue.

    It seems that this issue may not be reproducible in my current environment. Kindly please let me know if there are any additional steps or configurations that I might have missed that could help in replicating the problem.

    Thanks!

  • Status changed to Postponed: needs info 12 days ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States cilefen
Production build 0.71.5 2024