Problem/Motivation

After commenting out some core code to not be blocked by #3497683-6: [2.0.0-rc2] Field formatter does not check empty field, I have another fatal error when reinstalling.

See attached file. (note the line numbers in Context.php may differ because I had to put a debug_print_stacktrace() line. I don't know why I don't have my xdebug breakpoint working)

CommentFileSizeAuthor
#3 install_error_3.txt8.15 KBgrimreaper
install_error_2.txt8.19 KBgrimreaper
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

grimreaper created an issue. See original summary.

grimreaper’s picture

Issue summary: View changes
grimreaper’s picture

StatusFileSize
new8.15 KB

After commenting out in Context.php:

//      elseif ($definition->isRequired()) {
//        $type = $definition->getDataType();
//        debug_print_backtrace();
//
//        throw new ContextException("The '$type' context is required and not present.");
//      }

Now it is a new fatal in attachment...

pdureau’s picture

Title: Context error during installation » [2.0.0-rc2] Context error during installation
christian.wiedemann’s picture

Assigned: Unassigned » christian.wiedemann
christian.wiedemann’s picture

Hi @grimreaper, I can't reproduce this bug. I tried to install sobki_profile_dsfr but was not sucessful.
Can you give me a hint to install it.

  Problem 1
    - Root composer.json requires drupal/sobki_profile_dsfr ^10@alpha -> satisfiable by drupal/sobki_profile_dsfr[10.0.0-alpha1, 10.0.0-alpha2].
    - drupal/sobki_profile_dsfr 10.0.0-alpha1 requires npm-asset/gouvfr--dsfr 1.10.2 -> could not be found in any version, there may be a typo in the package name.
    - drupal/sobki_profile_dsfr 10.0.0-alpha2 requires npm-asset/gouvfr--dsfr 1.11.2 -> could not be found in any version, there may be a typo in the package name.

christian.wiedemann’s picture

Status: Active » Postponed (maintainer needs more info)
pdureau’s picture

grimreaper’s picture

Status: Postponed (maintainer needs more info) » Active

It is on the sobki_profile_bootstrap that there is a problem.

And more precisely on the MR on #3485615: [10.1.x] Upgrade to UIP2.

grimreaper’s picture

grimreaper’s picture

Hello,

I made some dichotomy to isolate the problematic configuration. by deleting all core.entity_view_display.* config and then reputting it one by one until failure during installation.

So when I list problematic config, it is when one of this config is present I have the bug.

With the following config:

  • config/install/core.entity_view_display.block_content.accordion.default.yml
  • config/install/core.entity_view_display.block_content.carousel.default.yml
  • config/install/core.entity_view_display.block_content.list_group.default.yml
  • config/install/core.entity_view_display.block_content.news_carousel.default.yml
  • config/install/core.entity_view_display.block_content.progress_bar.default.yml
  • config/install/core.entity_view_display.block_content.reference.default.yml
  • config/install/core.entity_view_display.block_content.references.default.yml
  • config/install/core.entity_view_display.block_content.references_media.default.yml
  • config/install/core.entity_view_display.media.document.default.yml
  • config/install/core.entity_view_display.media.link.default.yml

Failure after install_import_translations during install_configure_form:

[error] InvalidArgumentException: Field user_picture is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of /project/app/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

With the following config:

  • config/install/core.entity_view_display.block_content.blockquote.left.yml

Failure after install_profile_themes during install_install_profile:

The 'entity:block_content' context is required and not present.

With the following config:

  • config/install/core.entity_view_display.node.blog_post.teaser.yml
  • config/install/core.entity_view_display.node.job_offer.teaser.yml
  • config/install/core.entity_view_display.node.page.teaser.yml
  • config/install/core.entity_view_display.node.product.teaser.yml

Failure after install_profile_themes during install_install_profile:

[error]  TypeError: Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\Source\FieldFormatterSource::createInstanceFormatter(): Argument #2 ($field_definition) must be of type Drupal\Core\Field\FieldDefinitionInterface, null given, called in /project/app/modules/contrib/ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldFormatterSource.php on line 450 in Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\Source\FieldFormatterSource->createInstanceFormatter() (line 328 of /project/app/modules/contrib/ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldFormatterSource.php) #0 /project/app/modules/contrib/ui_patterns/modules/ui_patterns_field_formatters/src/Plugin/UiPatterns/Source/FieldFormatterSource.php(450): Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\Source\FieldFormatterSource->createInstanceFormatter('text_default', NULL)
#1 /project/app/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(71): Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\Source\FieldFormatterSource->calculateDependencies()
#2 /project/app/modules/contrib/ui_patterns/src/Plugin/UiPatterns/Source/DerivableContextSourceBase.php(472): Drupal\ui_patterns\SourcePluginBase->getPluginDependencies(Object(Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\Source\FieldFormatterSource))
#3 /project/app/modules/contrib/ui_patterns/src/Element/ComponentElementBuilder.php(278): Drupal\ui_patterns\Plugin\UiPatterns\Source\DerivableContextSourceBase->calculateDependencies()
#4 /project/app/modules/contrib/ui_patterns/src/Element/ComponentElementBuilder.php(224): Drupal\ui_patterns\Element\ComponentElementBuilder->calculateComponentDependenciesSlots(Object(Drupal\Core\Plugin\Component), Array, Array)
#5 /project/app/modules/contrib/ui_patterns/src/Form/ComponentFormBuilderTrait.php(234): Drupal\ui_patterns\Element\ComponentElementBuilder->calculateComponentDependencies('ui_suite_bootst...', Array, Array)
#6 /project/app/modules/contrib/ui_patterns/modules/ui_patterns_blocks/src/Plugin/Block/ComponentBlock.php(91): Drupal\ui_patterns_blocks\Plugin\Block\ComponentBlock->calculateComponentDependencies('ui_suite_bootst...', Array)
#7 /project/app/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(71): Drupal\ui_patterns_blocks\Plugin\Block\ComponentBlock->calculateDependencies()
#8 /project/app/core/lib/Drupal/Core/Plugin/PluginDependencyTrait.php(89): Drupal\Core\Config\Entity\ConfigEntityBase->getPluginDependencies(Object(Drupal\ui_patterns_blocks\Plugin\Block\EntityComponentBlock))
#9 /project/app/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(380): Drupal\Core\Config\Entity\ConfigEntityBase->calculatePluginDependencies(Object(Drupal\ui_patterns_blocks\Plugin\Block\EntityComponentBlock))
#10 /project/app/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(328): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->calculateDependencies()
#11 /project/app/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(272): Drupal\Core\Config\Entity\ConfigEntityBase->preSave(Object(Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage))
#12 /project/app/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(140): Drupal\Core\Entity\EntityDisplayBase->preSave(Object(Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage))
#13 /project/app/core/lib/Drupal/Core/Entity/EntityStorageBase.php(528): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->preSave(Object(Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplayStorage))
#14 /project/app/core/lib/Drupal/Core/Entity/EntityStorageBase.php(483): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay))
#15 /project/app/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(257): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay))
#16 /project/app/core/lib/Drupal/Core/Entity/EntityBase.php(354): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay))
#17 /project/app/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(617): Drupal\Core\Entity\EntityBase->save()
#18 /project/app/core/modules/layout_builder/src/Entity/LayoutBuilderEntityViewDisplay.php(166): Drupal\Core\Config\Entity\ConfigEntityBase->save()
#19 /project/app/core/lib/Drupal/Core/Config/ConfigInstaller.php(389): Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->save()
#20 /project/app/core/lib/Drupal/Core/Config/ConfigInstaller.php(149): Drupal\Core\Config\ConfigInstaller->createConfiguration('', Array)
#21 /project/app/core/lib/Drupal/Core/ProxyClass/Config/ConfigInstaller.php(75): Drupal\Core\Config\ConfigInstaller->installDefaultConfig('module', 'sobki_profile_b...')
#22 /project/app/core/lib/Drupal/Core/Extension/ModuleInstaller.php(326): Drupal\Core\ProxyClass\Config\ConfigInstaller->installDefaultConfig('module', 'sobki_profile_b...')
#23 /project/app/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)
#24 /project/app/core/includes/install.core.inc(1677): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)
#25 /project/app/core/includes/install.core.inc(695): install_install_profile(Array)
#26 /project/app/core/includes/install.core.inc(572): install_run_task(Array, Array)
#27 /project/app/core/includes/install.core.inc(121): install_run_tasks(Array, Array)
#28 /project/vendor/drush/drush/includes/drush.inc(69): install_drupal(Object(Composer\Autoload\ClassLoader), Array, Array)
#29 /project/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array('install_drupal', Array)
#30 /project/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(170): drush_op('install_drupal', Object(Composer\Autoload\ClassLoader), Array, Array)
#31 [internal function]: Drush\Commands\core\SiteInstallCommands->install('sobki_profile_b...', Array)
#32 /project/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#33 /project/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#34 /project/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#35 /project/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#36 /project/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 /project/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#38 /project/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 /project/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /project/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#41 /project/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#42 /project/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run(Array)
#43 /project/vendor/bin/drush.php(119): include('/project/vendor...')
#44 {main}.

Without all those problematic config, during installation even if installation is successful I have the following warnings:

...
[notice] Performed install task: install_profile_themes
[warning] The "field_block:block_content:text_media:body" block plugin was not found
[warning] The "field_block:block_content:text_media:field_media" block plugin was not found
[warning] The "field_block:block_content:text_media:body" block plugin was not found
[warning] The "field_block:block_content:text_media:field_media" block plugin was not found
[warning] The "field_block:block_content:key_number:field_number" block plugin was not found
[warning] The "field_block:block_content:key_number:field_suffix" block plugin was not found
[warning] The "field_block:block_content:key_number:body" block plugin was not found
[warning] The "field_block:block_content:key_number:field_number" block plugin was not found
[warning] The "field_block:block_content:key_number:field_suffix" block plugin was not found
[warning] The "field_block:block_content:key_number:body" block plugin was not found
[warning] The "field_block:block_content:featuring:field_media" block plugin was not found
[warning] The "field_block:block_content:featuring:field_heading" block plugin was not found
[warning] The "field_block:block_content:featuring:body" block plugin was not found
[warning] The "field_block:block_content:featuring:field_cta" block plugin was not found
[warning] The "field_block:block_content:featuring:field_media" block plugin was not found
[warning] The "field_block:block_content:featuring:field_heading" block plugin was not found
[warning] The "field_block:block_content:featuring:body" block plugin was not found
[warning] The "field_block:block_content:featuring:field_cta" block plugin was not found
[warning] The "block_content:d7b0e3ca-31a5-4697-84bc-95600bb2067a" block plugin was not found
[warning] The "field_block:taxonomy_term:tags:name" block plugin was not found
[warning] The "field_block:taxonomy_term:tags:name" block plugin was not found
[warning] The "field_block:paragraph:progress_bar:field_title" block plugin was not found
[warning] The "field_block:paragraph:progress_bar:field_title" block plugin was not found
[warning] The "field_block:paragraph:list_group_item:field_content" block plugin was not found
[warning] The "field_block:paragraph:list_group_item:field_content" block plugin was not found
[warning] The "field_block:paragraph:carousel_item:field_media" block plugin was not found
[warning] The "field_block:paragraph:carousel_item:field_caption" block plugin was not found
[warning] The "field_block:paragraph:carousel_item:field_media" block plugin was not found
[warning] The "field_block:paragraph:carousel_item:field_caption" block plugin was not found
[warning] The "field_block:paragraph:accordion_item:field_title" block plugin was not found
[warning] The "field_block:paragraph:accordion_item:field_text" block plugin was not found
[warning] The "field_block:paragraph:accordion_item:field_title" block plugin was not found
[warning] The "field_block:paragraph:accordion_item:field_text" block plugin was not found
[warning] The "field_block:block_content:blockquote:field_media" block plugin was not found
[warning] The "field_block:block_content:blockquote:field_quote" block plugin was not found
[warning] The "field_block:block_content:blockquote:field_footer" block plugin was not found
[warning] The "field_block:block_content:blockquote:field_media" block plugin was not found
[warning] The "field_block:block_content:blockquote:field_quote" block plugin was not found
[warning] The "field_block:block_content:blockquote:field_footer" block plugin was not found
[warning] The "field_block:block_content:alert:field_heading" block plugin was not found
[warning] The "field_block:block_content:alert:field_message" block plugin was not found
[warning] The "field_block:block_content:alert:field_heading" block plugin was not found
[warning] The "field_block:block_content:alert:field_message" block plugin was not found
[warning] The "field_block:node:product:title" block plugin was not found
[warning] The "field_block:node:product:body" block plugin was not found
[warning] The "field_block:node:product:field_media" block plugin was not found
[warning] The "field_block:node:product:field_featurings" block plugin was not found
[warning] The "field_block:node:product:field_related_content" block plugin was not found
[warning] The "field_block:node:product:title" block plugin was not found
[warning] The "field_block:node:product:body" block plugin was not found
[warning] The "field_block:node:product:field_media" block plugin was not found
[warning] The "field_block:node:product:field_featurings" block plugin was not found
[warning] The "field_block:node:product:field_related_content" block plugin was not found
[warning] The "field_block:node:news:field_teaser_media" block plugin was not found
[warning] The "field_block:node:news:title" block plugin was not found
[warning] The "field_block:node:news:field_teaser_text" block plugin was not found
[warning] The "field_block:node:news:created" block plugin was not found
[warning] The "field_block:node:news:field_teaser_media" block plugin was not found
[warning] The "field_block:node:news:title" block plugin was not found
[warning] The "field_block:node:news:field_teaser_text" block plugin was not found
[warning] The "field_block:node:news:created" block plugin was not found
[warning] The "field_block:node:job_offer:field_teaser_media" block plugin was not found
[warning] The "field_block:node:job_offer:title" block plugin was not found
[warning] The "field_block:node:job_offer:field_teaser_text" block plugin was not found
[warning] The "field_block:node:job_offer:created" block plugin was not found
[warning] The "field_block:node:job_offer:field_teaser_media" block plugin was not found
[warning] The "field_block:node:job_offer:title" block plugin was not found
[warning] The "field_block:node:job_offer:field_teaser_text" block plugin was not found
[warning] The "field_block:node:job_offer:created" block plugin was not found
[warning] The "field_block:node:blog_post:field_teaser_media" block plugin was not found
[warning] The "field_block:node:blog_post:title" block plugin was not found
[warning] The "field_block:node:blog_post:field_teaser_text" block plugin was not found
[warning] The "field_block:node:blog_post:field_tags" block plugin was not found
[warning] The "field_block:node:blog_post:created" block plugin was not found
[warning] The "field_block:node:blog_post:field_teaser_media" block plugin was not found
[warning] The "field_block:node:blog_post:title" block plugin was not found
[warning] The "field_block:node:blog_post:field_teaser_text" block plugin was not found
[warning] The "field_block:node:blog_post:field_tags" block plugin was not found
[warning] The "field_block:node:blog_post:created" block plugin was not found
[notice] Performed install task: install_install_profile
...

Also before encountering config bugs, I had to edit app/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php:

  public static function generateSampleValue(FieldDefinitionInterface $field_definition) {
    return [];

Otherwise there was a fatal with the array_rand in this method.

I hope that all those elements will help the debugging.

Maybe we can figure out common points with those configs.

pdureau’s picture

grimreaper’s picture

With current MR, I no more have the following errors:
- The 'entity:block_content' context is required and not present.
- [error] TypeError: Drupal\ui_patterns_field_formatters\Plugin\UiPatterns\Source\FieldFormatterSource::createInstanceFormatter(): Argument #2 ($field_definition) must be of type Drupal\Core\Field\FieldDefinitionInterface, null given,

Without editing app/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php, I no more have the associated fatal.

Warnings about block plugins not found remains but not a blocker and already there with UIP1 (not exactly the same but you guessed the point).

So remains:

[error]  InvalidArgumentException: Field user_picture is unknown. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 616 of /project/app/core/lib/Drupal/Core/Entity/ContentEntityBase.php).

I will check my translatability configs.

Thanks! Huge step forward!

grimreaper’s picture

Celebrated too early.

I still got:

[error]  ValueError: array_rand(): Argument #1 ($array) cannot be empty in array_rand() (line 358 of /project/app/core/modules/image/src/Plugin/Field/FieldType/ImageItem.php)
christian.wiedemann’s picture

I checked that also, but I thought it is not UI Patterns related.
But "Maybe" this happens because we call createInstance during calculateDependencies and the field is not setup correctly during that. Will check it.

pdureau’s picture

Assigned: grimreaper » christian.wiedemann
Status: Needs review » Needs work
grimreaper’s picture

For Field user_picture is unknown, Currently I am removing the user_picture field from Sobki. I think this problem is core because I saw similar issues on other projects but no issue on core.

Currently MR is too big.

So when merged in another issue I will re-add user_picture and demonstrate it is problematic.

But array_rand error remains.

grimreaper’s picture

I fixed errors with default content that I changed manually.

Now only remains array_rand

just_like_good_vibes made their first commit to this issue’s fork.

christian.wiedemann’s picture

We found the problem behind the ImageRand bug. The Image SVG Module generates an SVG sample value while saving a layout. This sample generated entity leads to this bug. See issue https://www.drupal.org/project/svg_image/issues/3170319

I tested the workaround mentioned in the issue:

I add to

field.field.media.image_svg.field_media_image.yml 
file_extensions: 'png svg'
christian.wiedemann’s picture

Status: Needs work » Needs review
grimreaper’s picture

Status: Needs review » Reviewed & tested by the community

Thanks! I confirm the workaround is working.

Updating Sobki MR.

pdureau’s picture

Assigned: christian.wiedemann » Unassigned
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

christian.wiedemann’s picture