4

I broke a view by adding the "flagged" relationship to the view, then filtering by the flag_id, then deciding against it and removing the relationship. The filter for flag_id was not removed when the relationship was removed so now I get an error on that view -- "The website encountered an unexpected error. Please try again later.".

The actual logged error is

Uncaught PHP Exception Exception: "No entity type for field flag_id on view frontpage" at ".../core/modules/views/src/Plugin/views/HandlerBase.php line 712"

I intended on going into the database to fix this but I feel like that's the nuclear option.

2 Answers 2

6

Go to /admin/config/development/configuration/single/export and export the .yml file for that view, manually delete the flag_id filter section, and reimport the .yml file under "Single Item", that should fix it.

3
  • I had not thought about doing it this way but thanks for the tip! This did actually fix the underlying issue. If I export the view again, the field_id is gone. Unfortunately however, when going to the view's UI, I still get the error. The view hasn't updated according to the view's ui
    – ovp
    Commented Apr 28, 2019 at 15:29
  • I'd try clearing the cache and disabling and re-enabling views_ui.
    – cchen
    Commented Apr 29, 2019 at 3:41
  • I actually ended up doing both of those immediately after trying out your solution above as well. It didn't work unfortunately. The only thing that seemed to work, finally, was downloading the .bin file from the config's data column and re-importing it. In reality, It was a combination of your fix and what I had to do to "update" the view for whatever reason.
    – ovp
    Commented May 2, 2019 at 15:37
1

Thank you to cchen above for a partial solution to the problem. I did indeed export the .yml file from /admin/config/development/configuration/single/export and edited it to remove the relationship and filter sections of the view.

This worked on the live portion of the site where the view is being displayed, however, the "dirty" state of the actual view remained in the database. I continued to get the PHP exception error after clearing the cache and disabling->re-enabling the view. Disabling the views module and views_ui module altogether didn't work either. The only thing that ended up working was going in the database, downloading the .bin file from the data column in the config table for that view and then re-uploading the .bin file, unchanged. It fixed the ability to actually open the view in the views_ui module for editing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.