user_picture prevents installation from profile

Created on 29 January 2025, 5 months ago

Problem/Motivation

Core: 10.4.1
PHP 8.3

On Sobki (Bootstrap) installation profile, I have the following error when trying a fresh install from the installation profile:

[notice] Performed install task: install_import_translations
 [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). 

It is triggered by core/lib/Drupal/Core/Installer/Form/SiteConfigureForm.php::submitForm() when user 1 is updated.

In [10.1.x] Upgrade to UIP2 Active , I had to remove user_picture to unblock the MR (where I witnessed the problem for the first time).

In Re-add user_picture field Active , I am trying to reput this field. And having isolated the change:
- without user_picture, the profile is installable
- with user_picture, the profile is no more installable.

I have not found issues on core, but some similar issues listed in "related issues" regarding other installation profiles.

Steps to reproduce

Try to install the Sobki installation profile from Re-add user_picture field Active .

Proposed resolution

Remaining tasks

Found bug origin.

API changes

Release notes snippet

🐛 Bug report
Status

Active

Version

10.4

Component

other

Created by

🇫🇷France Grimreaper France 🇫🇷

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

Merge Requests

Comments & Activities

  • Issue created by @Grimreaper
  • 🇳🇿New Zealand quietone

    Changes are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies .

  • 🇫🇷France goz

    I have the same issue.
    I use drush site:install minimal --existing-config

    In my config, i define field for user entity. Example: field.storage.user.field_firstname.yml
    This fields was created first with the ui and configured with views_display, form_display etc.

    If i want to reinstall site based on existing configuration, i have the issue :

     [notice] Performed install task: install_import_translations
    
    In SqlContentEntityStorage.php line 815:
                                        
      Field field_firstname is unknown.  
                                        
    
    In ContentEntityBase.php line 617:
                                        
      Field field_firstname is unknown.  
    
    

    Here is the backtrace :

    SqlContentEntityStorage.php:815, Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
    EntityBase.php:370, Drupal\Core\Entity\EntityBase->save()
    SiteConfigureForm.php:305, Drupal\Core\Installer\Form\SiteConfigureForm->submitForm()
    FormSubmitter.php:105, call_user_func_array:{/var/www/html/web/core/lib/Drupal/Core/Form/FormSubmitter.php:105}()
    FormSubmitter.php:105, Drupal\Core\Form\FormSubmitter->executeSubmitHandlers()
    FormSubmitter.php:43, Drupal\Core\Form\FormSubmitter->doSubmitForm()
    FormBuilder.php:589, Drupal\Core\Form\FormBuilder->processForm()
    AutosaveFormBuilder.php:144, Drupal\autosave_form\Form\AutosaveFormBuilder->processForm()
    FormBuilder.php:495, Drupal\Core\Form\FormBuilder->submitForm()
    install.core.inc:977, install_get_form()
    install.core.inc:611, install_run_task()
    install.core.inc:564, install_run_tasks()
    install.core.inc:122, install_drupal()
    (...)
    

    I doesn't seem to have the issue using UI installation.

  • 🇫🇷France goz

    Digging, here is what i find :

    1. user 1 is first created with placeholder for username, email, password
    2. than config is updated, so User entity has now new fields definitions.
    3. When user is updated to add configured username, email and password, it's loaded from cache, which was generated before we update the field definition.

    So i suggest to reset cache for the user before loading it to update datas.

  • Pipeline finished with Success
    3 days ago
    Total: 567s
    #537067
  • 🇫🇷France Grimreaper France 🇫🇷

    Hi,

    I have retested installation on Sobki with and without the proposed change, I confirm it fixes the bug.

    Thanks!

Production build 0.71.5 2024