Problem/Motivation

There is no schema entry for views.filter_value.comment_ces_last_updated, which triggers a fatal error when used in a view.

#2925890: Invalid config structures can result in exceptions when saving a config entity has a patch that addresses Drupal's reaction to the missing schema. This ticket is for providing the missing schema entry.

Steps to reproduce

Using a fresh install of Drupal 9.5:
Create an article node
Create a view that lists content
Put a filter on the view for "Last updated/commented" and set it to a relative time like "-10 minutes"
Save the view

Proposed resolution

Add the missing schema entry.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

Comments

jncruces created an issue. See original summary.

jncruces’s picture

Issue summary: View changes
jncruces’s picture

StatusFileSize
new17.59 KB

I get it working temporary appling the attached patch as reversed.

patch -p1 -R < 2873224-3-APPLY-REVERSED-PATCH.patch

The patch goes back the files to drupal-8.3.0-rc2 (http://cgit.drupalcode.org/drupal/commit/?id=6ca8ccc). Based on https://www.drupal.org/node/2369119#comment-12056954

mpdonadio’s picture

Version: 8.3.1 » 8.3.x-dev
Issue summary: View changes
Issue tags: +Needs tests, +Needs triage for core major current state

We need a functional test to demonstrate this problem.

andypost’s picture

Status: Active » Needs work
lendude’s picture

Issue tags: -views +VDC
StatusFileSize
new5.33 KB

Steps I tried to reproduce:

  • 8.4.x latest HEAD, minimal install with datetime and Views modules enabled
  • Add content type
  • Add a datetime field to the content type
  • Create a new View
  • Add the datetime field as an exposed filter
  • Save the View
  • No problem

Adding config file of the View I used

jncruces’s picture

I don't understand what is happening. After the update from 8.2.7 to 8.3.1 I have the problem. I removed the core folder and downloaded it through composer install. Always with the same error saving the views (I have a lot of views with date exposed fields with between operator configured).

Now I repeated the process. I removed the core folder, download it through composer install... now the problem was gone away... it's impossible, nothing has changed.

Maybe the configurations was updated and now are different. I will retry the upgrading, I have a database saved before upgrading.

jncruces’s picture

StatusFileSize
new55.14 KB
new50.56 KB

Yes... the problem persist.

InvalidArgumentException: The configuration property display.default.display_options.filters.field_document_validity_start_value.value.min doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 74 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_document_validity_start_value.value.min', '') (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_document_validity_start_value.value', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_document_validity_start_value', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display', Array) (Line: 212)
Drupal\Core\Config\Config->save() (Line: 280)
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('descargas', Object) (Line: 392)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 259)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 364)
Drupal\Core\Entity\Entity->save() (Line: 637)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 986)
Drupal\views_ui\ViewUI->save() (Line: 321)
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('view_edit_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 226)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, NULL)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 574)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 144)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 64)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 86)
Drupal\muprespa_profiles\StackMiddleware\ProfileMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 656)
Drupal\Core\DrupalKernel->handle(Object) (Line: 18)

I'm trying to reproduce in a clean environment.

1. Fresh installation.
2. On Article content type i added a Date field that store only dates.
3. Created a view and added some configuration to seem it with the problematic view.
4. Saving without problems.

But some is different. In my new installation the date field have not granularity.

Attached two images.

screen_20170428-142927.png -> Old view with problems.
screen_20170428-142957.png -> New view without problems.

jncruces’s picture

I'm sorry.

I have a custom module that is aggregating the granularity option to date and i think that some is wrong with the update of Drupal.

The site with the problem, a lot of people worked on it since more than a year ago. A lot of functionality is created for it. I have to study how to change these configuration.

I think that i can close this issue.

Greetings.

jncruces’s picture

Status: Needs work » Closed (works as designed)
lendude’s picture

@jncruces thanks for reporting back your findings.

handkerchief’s picture

Version: 8.3.x-dev » 8.4.x-dev
Status: Closed (works as designed) » Active

I have the same problem with Drupal Core 8.4.0

I don't think I have the same closed-issue-reason like @jncruces.

The website encountered an unexpected error. Please try again later.InvalidArgumentException: The configuration property display.default.display_options.filters.field_example_target_id.value.60072 doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php

Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_example_target_id.value.60072', '60072') (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_example_target_id.value', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters.field_example_target_id', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options.filters', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default.display_options', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display.default', Array) (Line: 211)
Drupal\Core\Config\StorableConfigBase->castValue('display', Array) (Line: 212)
Drupal\Core\Config\Config->save() (Line: 280)
Drupal\Core\Config\Entity\ConfigEntityStorage->doSave('timeline', Object) (Line: 392)
Drupal\Core\Entity\EntityStorageBase->save(Object) (Line: 259)
Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object) (Line: 377)
Drupal\Core\Entity\Entity->save() (Line: 637)
Drupal\Core\Config\Entity\ConfigEntityBase->save() (Line: 989)
Drupal\views_ui\ViewUI->save() (Line: 324)
Drupal\views_ui\ViewEditForm->save(Array, Object)
call_user_func_array(Array, Array) (Line: 111)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 585)
Drupal\Core\Form\FormBuilder->processForm('view_edit_form', Array, Object) (Line: 314)
Drupal\Core\Form\FormBuilder->buildForm('view_edit_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object, 'edit', Array) (Line: 226)
Drupal\views_ui\Controller\ViewsUIController->edit(Object, 'block_1')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 576)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
call_user_func_array(Object, Array) (Line: 153)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 60)
Drupal\shield\ShieldMiddleware->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 657)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
lendude’s picture

@handkerchief does this happen on a clean D8 install too? Can you provide a yml file of the View in question? Or give some steps to reproduce this on a clean D8 install?

handkerchief’s picture

So I found the "problem"... and yes, it's an individual problem.

I'm using this "trick" for selecting nodes in my exposed filter like taxonomies.
https://drupal.stackexchange.com/a/231771

The plugin is almost a duplicate from the taxonomy filter: https://gist.github.com/StryKaizer/ae1cb9abc4844a9e7ac12317a9d84a78

With this plugin (which should be also included in core - I mean the functionallity) the error appears. So I suppose the taxonomy filter had this problem too. If l knew what was changed there, I can adapt this for the plugin.

Any advice?

lendude’s picture

Status: Active » Closed (works as designed)

So you need to have a config schema for all Views filter plugins, otherwise Drupal has no idea how to save your data to config (it defaults to a string value, but that is not what you are using, hence the fail).

See core/modules/views/config/schema/views.filter.schema.yml and core/modules/taxonomy/config/schema/taxonomy.views.schema.yml for some examples.

something like this would do unless you store more data then the base taxonomy filter:

views.filter.your_plugin_id_here:
  type: views.filter.taxonomy_index_tid
  label: 'Taxonomy term ID extended'
handkerchief’s picture

@Lendude Thank you for the awesome and quick support. I wish other maintainers would react so quickly. Have a nice day.

golddragon007’s picture

I had this error:
InvalidArgumentException: The configuration property display.page_2.display_options.filters.title.value.value doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of D:\phptest\theideaproject\web\core\lib\Drupal\Core\Config\Schema\ArrayElement.php).

When I tried to save my views.
I have two node types. 1 has reference to the other one. I created an exposed filter with count aggregation, which works fine in preview. But when I tried to save, I get fatal error.

SakaSerbia’s picture

I get the some problem when update from drupal 8.3.7 to 8.4.2.

views module
Update revision_metadata_fields

Failed: InvalidArgumentException: The configuration property display.default.display_options.filters.field_tip_target_id.value.14 doesn't exist.
in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 у /site/core/lib/Drupal/Core/Config/Schema/ArrayElement.php).

View are no more update, they show the some content as in past. If I add now node its is not posible to see in view.

SakaSerbia’s picture

Status: Closed (works as designed) » Active
ohthehugemanatee’s picture

I'm experiencing this, too, with any View that uses the core taxonomy_index_tid filter . Happens during an update from 8.3.x -> 8.4.x

The schema is properly defined for this filter. It should be a sequence.

Here's what core exports for one of my Views, using this filter:

      field_term_section_target_id:
          id: field_term_section_target_id
          table: node__field_term_section
          field: field_term_section_target_id
          relationship: none
          group_type: group
          admin_label: ''
          operator: or
          value:
            26: 26
          group: 1
          exposed: false
          expose:
            operator_id: ''
            label: ''
            description: ''
            use_operator: false
            operator: ''
            identifier: ''
            required: false
            remember: false
            multiple: false
            remember_roles:
              authenticated: authenticated
            reduce: false
          is_grouped: false
          group_info:
            label: ''
            description: ''
            identifier: ''
            optional: true
            widget: select
            multiple: false
            remember: false
            default_group: All
            default_group_multiple: {  }
            group_items: {  }
          reduce_duplicates: false
          type: select
          limit: true
          vid: section
          hierarchy: false
          error_message: true
          plugin_id: taxonomy_index_tid

Looks fine to me.

But Sequence::get() (actually ArrayElement::get() ) does the following:

  public function get($name) {
    $parts = explode('.', $name);
    $root_key = array_shift($parts);
    $elements = $this->getElements();
    if (isset($elements[$root_key])) {
      $element = $elements[$root_key];
      // If $property_name contained a dot recurse into the keys.
      while ($element && ($key = array_shift($parts)) !== NULL) {
        if ($element instanceof TypedConfigInterface) {
          $element = $element->get($key);
        }
        else {
          $element = NULL;
        }
      }
    }
    if (isset($element)) {
      return $element;
    }
    else {
      throw new \InvalidArgumentException("The configuration property $name doesn't exist.");
    }
  }

That method receives "display.default.display_options.filters.field_term_section.value.26" as an argument.

When we get down to the term ID value, we get a StringData, which is not an instance of TypedConfigInterface... and that's where we get InvalidArgumentException.

I'm not sure where the actual bug is:
- Is Views exporting this one wrong? (not that I can tell)
- Is this related to the update? Doesn't look that any related code was changed...
- Should StringData be valid as well as TypedConfigInterface?
- Should StorableConfigBase::castValue() check the schema to see if it's a sequence, and simplify the value somehow?

I discovered this error during an update, when it tried to run views_post_update_revision_metadata_fields(). That function just runs save() on all your extant Views. I do not see an error when I save the View in the UI, however.

TO REPRODUCE:

* fresh install of Drupal 8.3.x, "standard" profile
* create a term in the "tags" vocabulary
* create a View of nodes, with a taxonomy_term_id filter for this term ("Content: tags: test term")
* save the View.
* update to Drupal 8.4.x

ohthehugemanatee’s picture

Status: Active » Closed (outdated)

Further debugging got me to the root of this: search_api_taxonomy module overrides the definition for the taxonomy_index_tid incorrectly. This is fixed in #2917399: Missing / broken handler when adding a filter for a field , which is included in search_api-8.x-1.6 .

Closing this ticket.

fernly’s picture

Version: 8.4.x-dev » 8.6.x-dev
Status: Closed (outdated) » Active

The issue still persists in drupal 8.6.0-beta2.

The fatal error appears when a default value is given to a views filter and the view gets saved. The filter in my case is custom and extends the in_operator filter. It basically only adds other option values instead of the default Yes/No.

lendude’s picture

Status: Active » Postponed (maintainer needs more info)

@lennartvv see #15, did you add a config schema for your custom filter?

So you need to have a config schema for all Views filter plugins, otherwise Drupal has no idea how to save your data to config (it defaults to a string value, but that is not what you are using, hence the fail).

See core/modules/views/config/schema/views.filter.schema.yml and core/modules/taxonomy/config/schema/taxonomy.views.schema.yml for some examples.

fernly’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

I was looking at that right after my post :-).

That solved the issue indeed. Though it was really trial and error as documentation is so low on this matter. Thanks for the quick response!

#15 contains the solution: all views filter plugins need config schema.

kasey_mk’s picture

I had a problem with a view using the "Embed" display and the comment_ces_last_updated filter from Comment Statistics. Every time I tried to save my view:

InvalidArgumentException: The configuration property display.default.display_options.filters.last_updated.value.min doesn't exist. in Drupal\Core\Config\Schema\ArrayElement->get() (line 76 of core/lib/Drupal/Core/Config/Schema/ArrayElement.php). 

Patch #18 from https://www.drupal.org/project/drupal/issues/2925890 seemed to help.

lendude’s picture

@Kasey_MK that patch doesn't really fix the issue, it just changes it from an exception to a watchdog error. The underlying problem is most likely that Comment Statistics should have a config schema for the filter (didn't check).

kasey_mk’s picture

I did find the config schema for the filter in comment.views.schema.yml:

views.filter.comment_ces_last_updated:
  type: views.filter.date
  label: 'Newer of last comment / node updated'

Which is what's used in my view as the plugin_id:

filters:
        last_updated:
          id: last_updated
          table: comment_entity_statistics
          field: last_updated
          relationship: none
          group_type: group
          admin_label: ''
          operator: '>='
          value:
            min: ''
            max: ''
            value: '-1 day'
            type: offset
          group: 1
          exposed: false
          expose:
            operator_id: ''
            label: ''
            description: ''
            use_operator: false
            operator: ''
            operator_limit_selection: false
            operator_list: {  }
            identifier: ''
            required: false
            remember: false
            multiple: false
            remember_roles:
              authenticated: authenticated
            placeholder: ''
            min_placeholder: ''
            max_placeholder: ''
          is_grouped: false
          group_info:
            label: ''
            description: ''
            identifier: ''
            optional: true
            widget: select
            multiple: false
            remember: false
            default_group: All
            default_group_multiple: {  }
            group_items: {  }
          plugin_id: comment_ces_last_updated
hongqing’s picture

I got the same error "InvalidArgumentException: The configuration property display.page_search.display_options.filters.title.value.min doesn't exist." with 8.9.16.

I used one indexed filed to create an exposed filter, the indexed field is "fulltext", when I change it to "string", this error disappears.

I reinstall Views Autocomplete Filters module and it works again. Therefore, I am not sure if it is the problem of this module or the core.

hongqing’s picture

Version: 8.6.x-dev » 8.9.x-dev
Status: Closed (works as designed) » Active
hongqing’s picture

Status: Active » Closed (works as designed)
solrsearching’s picture

#28 is a solution but if you want to search using 'contains' in your view filter then you need 'fulltext' and then you get the error (I managed to make it work on one field, but I don't know how anymore .. :-/ )

kasey_mk’s picture

These two steps seem to have stabilized my site and I'm no longer seeing errors on saving my view nor on config-imports:

  1. Apply the patch from https://www.drupal.org/project/drupal/issues/2925890 (I'm currently using #29)
  2. Change the plugin_id for the troublesome filter in views.view.VIEWNAME.yml from comment_ces_last_updated to numeric
kasey_mk’s picture

StatusFileSize
new660 bytes

I think I have finally figured this one out (at least for the schema that was missing in my use case) - we need a schema for views.filter_value.comment_ces_last_updated
in core/modules/comment/config/schema/comment.views.schema.yml as follows:

views.filter_value.comment_ces_last_updated:
  type: views.filter_value.date
  label: 'Newer of last comment / node updated'

views.filter_value.date is of type views.filter_value.numeric which is defined in core/modules/views/config/schema/views.filter.schema.yml and which contains the missing min, max, and value schemas. Patch attached.

This problem definitely still exists in Drupal 9.5.x on a fresh install. Create some content and then try to create a view with a "Updated/commented date" filter set to something like "Is greater than or equal to" an offset value of something like "-10 minutes." The view can't be saved and yields the fatal error in this issue.

For other missing schemas, perhaps the issue is similar?

kasey_mk’s picture

Status: Closed (works as designed) » Needs review
darvanen’s picture

Title: Fatal error when trying to save a View, getting InvalidArgumentException » Add missing schema for views.filter_value.comment_ces_last_updated
Version: 8.9.x-dev » 9.5.x-dev
Priority: Major » Normal
Issue summary: View changes
Issue tags: +Bug Smash Initiative

I have reproduced this problem per the steps to reproduce provided in #33.

As correctly noted in #32 there is already a ticket for handling the exception, so I'm setting the purpose of this ticket to be the provision of the missing schema entry.

I did try the patch in #33 and it worked well, thank you. Having made such a big change to the IS however, I don't think I can push this to RTBC.

mstrelan’s picture

Version: 9.5.x-dev » 10.1.x-dev
Component: views.module » comment.module
Status: Needs review » Needs work
Issue tags: -Needs triage for core major current state, -VDC

Had a look and agree that #33 is an appropriate fix for this. I had a look if there were any other filters with type: views.filter.date in comment.views.schema.yml but this is the only one.

Moving this to comment.module rather than views.module since that's where the integration exists. Also moving to 10.1.x because I guess we need to fix it there first before a backport.

Finally, I think we should add some test coverage around this. There are some tests in the Drupal\Tests\comment\Kernel\Views namespace that might be worth looking at, for example CommentUserNameTest sounds like it might be testing similar functionality, or perhaps \Drupal\Tests\comment\Functional\Views\CommentFieldFilterTest.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.