0

My instance of drupal is throwing an error. The file that is throwing the error is modules/field/field.crud.inc

The error is

FieldException: Cannot change an existing field's type. in field_update_field() (line 240 of modules/field/field.crud.inc).

A local var dump displays the following results.

Variable $field

array (
  'active' => 1,
  'cardinality' => 1,
  'deleted' => 0,
  'entity_types' => 
  array (
  ),
  'field_name' => 'field_address',
  'foreign keys' => 
  array (
    'format' => 
    array (
      'columns' => 
      array (
        'format' => 'format',
      ),
      'table' => 'filter_format',
    ),
  ),
  'indexes' => 
  array (
    'format' => 
    array (
      0 => 'format',
    ),
  ),
  'locked' => 0,
  'module' => 'text',
  'settings' => 
  array (
    'max_length' => 255,
  ),
  'translatable' => 0,
  'type' => 'text',
)

Variable $prior_field

array (
  'translatable' => '0',
  'entity_types' => 
  array (
  ),
  'settings' => 
  array (
  ),
  'storage' => 
  array (
    'type' => 'field_sql_storage',
    'settings' => 
    array (
    ),
    'module' => 'field_sql_storage',
    'active' => '1',
    'details' => 
    array (
      'sql' => 
      array (
        'FIELD_LOAD_CURRENT' => 
        array (
          'field_data_field_address' => 
          array (
            'country' => 'field_address_country',
            'administrative_area' => 'field_address_administrative_area',
            'sub_administrative_area' => 'field_address_sub_administrative_area',
            'locality' => 'field_address_locality',
            'dependent_locality' => 'field_address_dependent_locality',
            'postal_code' => 'field_address_postal_code',
            'thoroughfare' => 'field_address_thoroughfare',
            'premise' => 'field_address_premise',
            'sub_premise' => 'field_address_sub_premise',
            'organisation_name' => 'field_address_organisation_name',
            'name_line' => 'field_address_name_line',
            'first_name' => 'field_address_first_name',
            'last_name' => 'field_address_last_name',
            'data' => 'field_address_data',
          ),
        ),
        'FIELD_LOAD_REVISION' => 
        array (
          'field_revision_field_address' => 
          array (
            'country' => 'field_address_country',
            'administrative_area' => 'field_address_administrative_area',
            'sub_administrative_area' => 'field_address_sub_administrative_area',
            'locality' => 'field_address_locality',
            'dependent_locality' => 'field_address_dependent_locality',
            'postal_code' => 'field_address_postal_code',
            'thoroughfare' => 'field_address_thoroughfare',
            'premise' => 'field_address_premise',
            'sub_premise' => 'field_address_sub_premise',
            'organisation_name' => 'field_address_organisation_name',
            'name_line' => 'field_address_name_line',
            'first_name' => 'field_address_first_name',
            'last_name' => 'field_address_last_name',
            'data' => 'field_address_data',
          ),
        ),
      ),
    ),
  ),
  'foreign keys' => 
  array (
  ),
  'indexes' => 
  array (
  ),
  'id' => '132',
  'field_name' => 'field_address',
  'type' => 'text',
  'module' => 'text',
  'active' => '1',
  'locked' => '0',
  'cardinality' => '1',
  'deleted' => '0',
  'columns' => 
  array (
    'value' => 
    array (
      'type' => 'varchar',
      'length' => NULL,
      'not null' => false,
    ),
    'format' => 
    array (
      'type' => 'varchar',
      'length' => 255,
      'not null' => false,
    ),
  ),
)   
  • Were you trying to change a field's type and then got this error? Or did it just appear out of the blue? – longboardnode Apr 26 '16 at 0:30
  • It's a long standing issue that I have not been able to resolve. – Rick Apr 26 '16 at 19:44
  • please provide more info, like an answer to my question above for example, or remove this question. without more data, this question is too specific to your environment and it's very difficult to resolve on this forum – longboardnode Apr 26 '16 at 19:59
  • I think it simple enough to solve. It has something to do with the database and the field causing a collision, my question is what fields is it and why. I can provide more details as long as they are related to the problem. – Rick Apr 27 '16 at 1:28
  • Fair enough. Do you get the error message when you view every page, or only on a specific content type? – longboardnode Apr 27 '16 at 13:49
1

This is my solution to this problem, i'm going to also document how I found the solution.

If you see the message that something went wrong stop and look at the logs that Drupal reports back to you and take the time to read them.

In this example I was getting this error due to a specific module and when Drupal was faulting out the module basic_cart_order was the last one to be rebuilding based on the logs.

Now that I knew what module was faulting out it was time to find out why. I found the fields that where causing the message field_address and I looked within in that module for that value.

grep -R "field_address"

That brought me over to this file

sites/all/modules/basic_cart/basic_cart_order/basic_cart_order.features.field_base.inc

I opened up that file and made a couple of changes to all the fields that where causing a conflict to the database. You can find all the fields that cause the error in your log message. I added a prefix to all the fields with basic_cart_order.

This fixed the problem down to the line that was throwing the error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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