Error during a drush "site-install" with existing config (if the captcha is globally enabled)

Created on 27 May 2025, about 1 month ago

Problem/Motivation

Hello,

When I run the drush "site-install" command, it throws the following error: The Math question field is required.

This error occurs when Drupal executes the "install_configure_form" task when the "enable_globally" configuration is set to 1.
If I set it to 0, I don't get this error.

The Drupal installation uses a Drupal form for this task (see web/core/includes/install.core.inc line 815), and it seems that the captcha is automatically generated in the form.

Steps to reproduce

  1. From an existing site (tested with Drupal 11.1.6), with the Captcha module enabled.
  2. Enable captchas on all forms (set the "enable_globally" property to 1 in the captcha.settings.yml file)
  3. Export the configuration
  4. Reinstall the site with Drush using the existing configurations: vendor/bin/drush site-install minimal --existing-config ...
  5. The error "The field Math question is required." appears immediately after the "install_import_translations" task (if "locale" is enabled), otherwise after the "install_config_revert_install_changes" task.

Proposed resolution

To work around the problem, I had to create a "captcha_point" for "install_configure_form" where I disable the captcha.
Example:

uuid: aa47f69a-7e7b-4b8f-9ead-94907dc0fed7
langcode: fr
status: false
dependencies: {  }
_core:
  default_config_hash: XbughDuwgOtc_8ztmYxz84gaXBeR760xH3bGSKD9v1Q
formId: install_configure_form
captchaType: default
label: 'install_configure_form (needed to prevent error on drush site-install)'

Remaining tasks

En solution pérenne, je propose d'ajouter une condition dans la méthode "captcha_form_alter" pour empêcher l'ajout du captcha sur le formulaire "install_configure_form".

Do you have a better suggestion?

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇫🇷France S3b0uN3t Nantes

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

Comments & Activities

Production build 0.71.5 2024