Problem/Motivation
when removing a custom field in
https://www.lmgm9.ugent.be/admin/config/people/accounts/fields
user field not removed cleanly, breaks all node edit due to author link or user entity reference.
error The website encountered an unexpected error. Please try again later.
Drupal\Core\Entity\Query\QueryException: 'field_user_id_account' not found in Drupal\Core\Entity\Query\Sql\Tables->ensureEntityTable() (line 369 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php).
field still listed in contend devel display full dump attached
[settings:protected] => Array
(
[handler] => default:user
[handler_settings] => Array
(
[target_bundles] =>
[sort] => Array
(
[field] => field_user_id_account
[direction] => DESC
)
[auto_create] =>
[filter] => Array
(
[type] => role
[role] => Array(9)
)
[include_anonymous] =>
)
)
[required:protected] => 1
[translatable:protected] =>
[default_value:protected] => Arrayreadding the field removes the error(db field get created again)
Steps to reproduce
create account field
add entity reference field to user on Content type (mandatory?)
Add some content
remove custom account field
enjoy the error
Proposed resolution
complete delete all field references used or not
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| devel_dump.txt | 117.34 KB | ikeigenwijs |
Comments
Comment #3
enaznin commentedFollowed the steps, but could not reproduce them on fresh install of Drupal 9.5 and Drupal 10.1
Comment #4
cilefen commentedComment #6
smustgrave commentedSince there hasn't been a follow up in almost a year going to close out for now. If still valid please reopen adding steps to reproduce.
Comment #7
ikeigenwijs commentedi was going through old tickets,
still an issue when removing te old field from user profile.
i dont know how to reproduce exactly.
but we did this:
1) create field 'user_id_account' in /admin/config/people/accounts/fields
wil result in 'field_user_id_account'
2) I presume this field is added to projects on some point, not visible now(prior to removing the recreated field)
also no usages listed on /admin/config/people/accounts/fields
3) remove the field in /admin/config/people/accounts/fields
when deleting this field some reference stays of this field somewher, did not find it.
4) edit node, save /node/101/editget error
field does not appear on the contenttype but node save breaks everyphin.
did cache clear after removal.
a pointer to the richt location or tables, next search is just a file And db grep to vind the ghost entry.
found references in following tables:
key_value_expire
config
cache_default
cache_config
key_value
cache_delta
Quite a lot for a deleted field and cleared cache
Comment #8
quietone commentedChanges are made on on 11.x (our main development branch) first, and are then back ported as needed according to the Core change policies.