Field storage does not exist error

Created on 27 March 2024, 3 months ago
Updated 26 June 2024, 3 days ago

Problem/Motivation

When configuring a new Calendar download field, upon selecting the date field to use as the source/reference from the select field, an AJAX and watchdog error is thrown. On subsequent pages loads across the site the error is also thrown, preventing the page from loading. I've only found two ways out of this error:
1. Drop the database.
2. Manually create the missing config and run config import.

Steps to reproduce

  1. Install and enable the module.
  2. Add a Calendar download field to content type that has a date_recur field.
  3. In field settings, select the date_recur field. The error will thrown after the AJAX request. In watch dog you'll see: Error Drupal\Core\Field\FieldException: Attempted to create an instance of field with name field_ics_download on entity type node when the field storage does not exist. in Drupal\field\Entity\FieldConfig->getFieldStorageDefinition() (line 316 of /app/docroot/core/modules/field/src/Entity/FieldConfig.php) "field_ics_download" will be the name of your field. This error will be shown on most subsequent page loads.

In order to get around this issue for now, I manually created the missing config. If you run into this error, for now you can create this file in your default config directory and then run config import. Then go back to the configuration for the field and configure it as needed, then run config export.

field.storage.node.field_ics_download.yml (replace "field_ics_download" with the name of your calendar download field. replace "field_event_date" with the name of your date field.)

langcode: en
status: true
dependencies:
  module:
    - ics_field
    - node
id: node.field_ics_download
field_name: field_ics_download
entity_type: node
type: calendar_download_type
settings:
  date_field_reference: field_event_date
  file_directory: icsfiles
  is_ascii: false
  uri_scheme: public
module: ics_field
locked: false
cardinality: 1
translatable: true
indexes: {  }
persist_with_no_fields: false
custom_storage: false

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @maskedjellybean
  • πŸ‡ΊπŸ‡ΈUnited States maskedjellybean Portland, OR
  • I had this error message when i created a new FiledType.
    I chose names for columns in the schema (example: this_is_an_example_schema_column_name) that were too long.
    When i wanted to create the field in the backend with name mycustom_options (example: field_mycustom_options) than i got that error.
    But when i created the field in the backend with name foo (field_foo) it worked.

    The reason for that was, that the field name and the column names i chose in my schema were combined in the database as column name.
    Example:
    - field_mycustom_options_this_is_an_example_schema_column_name
    - field_foo_this_is_an_example_schema_column_name

    so - the problem was, that the resulting column name was too long for drupals column name restrictions and drupal obviously refused to create the schema with that nice message.

    Solution for me was to shorten the column names in my Custom FieldType.

Production build 0.69.0 2024