Respect the submission guidelines above! Drupal.org issue forks cause additional work for the project maintainer!

Setup

  • Solr version: n/a
  • Drupal Core version: 10.2
  • Search API version:n/a
  • Search API Solr version: 4.3.2
  • Configured Solr Connector: n/a

Issue

Install this module
Install config inspector
View the report at: /admin/reports/config-inspector
Error thrown on search_api_solr.solr_cache.*:solr_configs because it is null and the validator is expecting an empty array.

CommentFileSizeAuthor
#13 Screenshot 2024-03-08 at 17.45.54.png248.48 KB2dareis2do

Comments

heddn created an issue. See original summary.

heddn’s picture

I think is comes from all of the nullable: true stuff all over the config schema in this module. There is a lot of it though, so I wonder if something in core should be handling this differently.

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)

Does this happen only when using https://www.drupal.org/project/config_inspector's UI?

heddn’s picture

Status: Postponed (maintainer needs more info) » Active

Automated testing in the CI where we essentially do protected $strictConfigSchema = TRUE does not trigger any exceptions. Running drush config:inspect --only-error and the web UI trigger the same exception logic.

wim leers’s picture

Status: Active » Postponed (maintainer needs more info)
Related issues: +#3092298: Solr Caches should be managed via Drupal's config management

Thanks for the fast response! 👍

Automated testing in the CI where we essentially do protected $strictConfigSchema = TRUE does not trigger any exceptions.

Excellent, that means no production sites are impacted 👍

Running drush config:inspect --only-error and the web UI trigger the same exception logic.

That's because I changed \Drupal\config_inspector\ConfigInspectorManager::validateValues() (I'm a co-maintainer of Config Inspector now) in #3359418: Expose validation constraint violations in Config Inspector UI and drush command to execute validation constraints.

You should be able to reproduce this ever since #3092298: Solr Caches should be managed via Drupal's config management happened, with the most recent version of Config Inspector, on all versions of Drupal core.

Could you please try this on Drupal 10.1 or 10.0? 🙏 That'd confirm my hypothesis 😊

heddn’s picture

Status: Postponed (maintainer needs more info) » Active

What version of config inspector? The most recent? None of my sites are still using 10.0/10.1 any more but when were still using it, we didn't have issues. It was only recently this started.

wim leers’s picture

What is the exact validation error message, by which validation constraint does it get generated?

heddn’s picture

Line 22-24 is what is triggered. Solr has those values as null. But the validator thinks they should be an empty array.

    if (!is_array($value)) {
      throw new UnexpectedTypeException($value, 'array');
    }
2dareis2do’s picture

Thanks @heddin. I am having similar issue with custom migrate script using custom module with migrate_plus dependency and migration lookup config?

Created a new issue here:

https://www.drupal.org/project/migrate_plus/issues/3421445

2dareis2do’s picture

Is there a core issue for this?

2dareis2do’s picture

I was able to add the following to circumvent fatal error on migrate lookup config

migration_dependencies:
  required: {  }
  optional: {  }
2dareis2do’s picture

This is the error I am seeing:

Symfony\Component\Validator\Exception\UnexpectedTypeException: Expected argument of type "array", "null" given in Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraintValidator->validate() (line 23 of core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/ValidKeysConstraintValidator.php).
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateConstraints(NULL, '00000000000014f10000000000000000', Array) (Line: 154)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object) (Line: 164)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 106)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, NULL, NULL) (Line: 93)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object) (Line: 132)
Drupal\Core\TypedData\TypedData->validate() (Line: 352)
Drupal\config_inspector\ConfigInspectorManager->validateValues('search_api_solr.solr_cache.cache_document_default_7_0_0') (Line: 176)
Drupal\config_inspector\Controller\ConfigInspectorController->overview()
call_user_func_array(Array, Array) (Line: 123)

This can be reproduced by going to /admin/reports/config-inspector/search_api_solr.solr_cache.cache_document_default_7_0_0/list

2dareis2do’s picture

StatusFileSize
new248.48 KB

From /admin/config/search/search-api/server/streathamlife/solr_cache

We have the following (see attached)

namely

@label	Minimum Solr Version	Environment	Machine name	Enabled	Operations
Document Cache	7.0.0	default	cache_document_default_7_0_0		Disable
Field Value Cache	7.0.0	default	cache_fieldvalue_default_7_0_0		Disable
Filter Cache	7.0.0	default	cache_filter_default_7_0_0		Disable
Per Segment Filter Cache	7.0.0	default	cache_persegfilter_default_7_0_0		Disable
Query Result Cache	7.0.0	default	cache_queryresult_default_7_0_0		Disable

The following config schema work ok:
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_filter_default_7_0_0/list
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_queryresult_default_7_0_0/list
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_fieldvalue_default_7_0_0/list
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_filter_default_9_0_0/list

These ones don't

/admin/reports/config-inspector/search_api_solr.solr_cache.cache_document_default_7_0_0/list
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_persegfilter_default_7_0_0/list
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_document_default_9_0_0/list
/admin/reports/config-inspector/search_api_solr.solr_cache.cache_persegfilter_default_9_0_0/list

see full error stack/log dump above.

2dareis2do’s picture

working:

langcode: en
status: true
dependencies:
  module:
    - search_api_solr
id: cache_fieldvalue_default_7_0_0
label: 'Field Value Cache'
minimum_solr_version: 7.0.0
environments: {}
cache:
  name: fieldValue
  class: solr.FastLRUCache
  size: 512
  autowarmCount: 128
  showItems: 32
solr_configs:
  query:
    -
      name: enableLazyFieldLoading
      VALUE: 'true'

Not working

langcode: en
status: true
dependencies:
  module:
    - search_api_solr
id: cache_document_default_7_0_0
label: 'Document Cache'
minimum_solr_version: 7.0.0
environments: {}
cache:
  name: document
  class: solr.LRUCache
  size: 512
  initialSize: 512
  autowarmCount: 0
2dareis2do’s picture

wim leers’s picture

#15: what does that mean, that #3364109 fixed "the issue"? #3364109: Configuration schema & required values: add test coverage for `nullable: true` validation support was committed to Drupal 10.3 and 11 on December 15 … and I guess I'm answering my own question: it sounds like this happens on Drupal 10.2, which doesn't have that addition.

I'm currently investigating #3359418: Expose validation constraint violations in Config Inspector UI and drush command, which should make Config Inspector work not crash on any config (even invalid config or config with invalid schema — note I'm not sure yet that is actually the case here, but I'm just stating that Config Inspector should always work and not crash 😊 — otherwise it's a bug in Config Inspector).

wim leers’s picture

Title: ValidKeysConstraintValidator thrown by config inspector » ValidKeysConstraintValidator thrown by Config Inspector on Drupal 10.1.x and 10.2.x due to core bug triggered only by Config Inspector
Category: Bug report » Support request
Status: Active » Fixed

#16: found the answer: #3416934-23: Config Inspector crashes on 10.1.x + 10.2.x for `type: mapping` with `nullable: true` due to core bug.

Work-around committed. In Drupal 10.3 and newer that work-around won't be necessary anymore 👍

2dareis2do’s picture

Thank you

core bug triggered only by Config Inspector

That confused me for a while. The problem was the breaking change in config inspector afaict

mkalkbrenner’s picture

Thank you!

Status: Fixed » Closed (fixed)

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