I am working on a site in which I have created a new Field Type: MyCustomFieldType (+widget/Formatter)
A field of this type has been added (name=field_mb_orders) to a paragraph field [and this paragraph to a node].
Everything runs fine but at some stage I need to drush cr and I got the following error:
Unable to determine class for field type 'MyCustomFieldType' found in 'field.storage.paragraph.my_field'
Of course the module and plugIn files for the fieldType exists... (restarted apache in any case)
The only way I could solve this is by running the following commands:
drush sqlq "DELETE FROM cache_config"
drush sqlq "DELETE FROM config WHERE name = 'field.storage.paragraph.field_mb_orders' OR data LIKE '%field.storage.paragraph.field_mb_orders%'"
drush sqlq "DELETE FROM config_snapshot WHERE name = 'field.storage.paragraph.field_mb_orders' OR data LIKE '%field.storage.paragraph.field_mb_orders%'"
After those commands, my site is usable but I still need to re-add field_mb_orders to my paragraph (which is ok as there are no data for it yet)
This is the third time it happens...
Note 1: there are no config file for this custom Field Type as there are no settings for it..
Note 2: Don't know if this is a paragraphs issue or a core issue
FYI: The first time it happens I was thinking it was a problem with the underscores inside the class names... but I removed them and I got this problem few time after
Comments
Comment #2
cilefen commentedWe don’t know if the custom code in the context of this issue is using APIs appropriately so I’m bumping this to normal priority.
Comment #3
dunebl@cilefen: fair enough...
But even if I don't use appropriately the API, how can we explain
A-Site/Custome Field Type/Widget are working
B-Clear cache => Site is down [I am sure at 95% that I made other drush cr before]
C-Removing some occurrences in the DB WITHOUT changing anything in the source file => Site is back
D-Clear cache =>My custom field type is back
Comment #4
berdirThe error happens if that field type is not found, which is either because it is missing in the file system or the module is not enabled.
This is an explicit error message telling you about that, Drupal can't function in that state with the code missing, so there really isn't much that could be done about it except telling you about the error.
What I noticed is that you used a) camel case for the plugin/field type ID, which is very uncommon but *should* not cause problems and b) MyCustomFieldType really isn't a good field type ID ;)
I suggest you share the name of your module and its location, FQDN of the plugin class, its annotation and anything else you think might be relevant. But this is very unlikely to be a problem in core or in contrib.
> Note 1: there are no config file for this custom Field Type as there are no settings for it..
I'm not sure what that means, clearly there *is* configuration for it, that field?
Note that you delete possibly quite a lot with that statement, e.g. all form/view displays that depend on it.
Comment #5
dunebl@Berdir many thank for your help...
I keep getting this problem... and I can replicate it by following the steps (poorly) described in #3
In other words, I can follow this looping process:
Working web site => drush cr => Not working web site => remove records in db (see #1) => drush cr => Working web site
Before sharing the code (to avoid loosing your time... but see below), I discovered that I have a message in the
/admin/reports/statuspage regarding the fields that I have created (using my custom field type)The %field_name field needs to be uninstalled.To solve this, I ran cron, I
drush crand finallydrush entup=>but this last step display the following error:mwdis the id of my problematic custom field type...Unfortunately I can't get rid of it: impossible to remove this warning in the
/admin/reports/statuspageIf you think it is appropriate, here is the code of my field type
As a side note:
1-The problem is not linked with the paragraph module as I have tested this field in a node: same result
2-Clearing the caches with devel does not trigger the error... only with drush cr
3-let me know if you need the widget part
Comment #7
devkinetic commentedI've run into this recently on the last couple of Drupal 8.8 releases. It's always after adding a module that defines a new field type and when I've just run
drush cim -yto update an environment.I can consistently work around it by running
drush en module_name && drush en module_nameEach time, I see
[notice] Already enabled: module_namebut something is happening because everything is fine afterwards.Comment #8
paulmicha commentedThere are 2 situations (Drupal 8.7.12, Drush 9.7.2) where I've experienced this error :
drush site install, after having manually updated some field config exported.ymlfile in a feature module - specifically : adding a new paragraph type in a reference field (entity_reference_revisions)The 1st case is solved relatively painlessly using workarounds such as https://drupal.stackexchange.com/a/246231/10419 (as originally described in this issue).
I'm currently stuck on the 2nd case which occurs during site install. The exact error message I get is :
Unable to determine class for field type '' found in the 'field.field.' configuration..The exact same error was apparently also encountered here : https://www.drupal.org/project/avatars/issues/3051270
There are no missing dependency errors.
Potentially relevant contrib modules versions :
Details :
in
web/core/lib/Drupal/Core/Field/FieldConfigStorageBase.php, functionmapFromStorageRecords()- both$record['field_type']and$config_idare empty or NULL :Whereas the
field_typeis there higher up in the call stack, i.e. inweb/core/lib/Drupal/Core/Config/ConfigInstaller.php, functioncreateConfiguration()line 337 - in variable$config_to_create:However, there's no
$idinweb/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php, functiondoLoadMultiple()line 189 :Comment #10
aubjr_drupal commentedIf you don't know which config settings are causing the issue (I ran into this when trying to uninstall a config-related module), try a join query (like below). It'll point out what config entries aren't being rebuilt in cache_config.
SELECT cc.cid, c.name FROM `config` c LEFT JOIN `cache_config` cc ON cc.cid = c.name WHERE cc.cid IS NULL and c.name LIKE 'field.field.%';Comment #11
avpadernoOn Drupal 8.9.x, only security issues are fixed.
Comment #14
kristen polAs part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)". This issue was marked "Postponed (maintainer needs more info)" almost 4 years ago.
Since that time, several comments indicate that this may be an issue that can be reproduced but we still need concrete steps to reproduce that start with a vanilla Drupal install.
Since we need more information to move forward with this issue, I am keeping the status at Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.
Thanks!
Comment #16
kristen polAs part of the Bug Smash Initiative, we are triaging issues that are marked "Postponed (maintainer needs more info)". This issue was marked "Postponed (maintainer needs more info)" many years ago.
Since there was no additional information provided since it was requested last year, I'm marking the issue "Closed (cannot reproduce)". If anyone can provide complete steps to reproduce the issue (starting from "Install Drupal core"), document those steps in the issue summary and set the issue status back to "Active" [or "Needs Work" if it has a patch, etc.].
Thanks!