This only happens after the module has already been installed. I disable and then later re-enable it and get this error (from drush):


WD php: FieldException: Attempt to create an instance of field file [error]
on bundle default that already has an instance of that field. in
field_create_instance() (line 683 of .../modules/field/field.crud.inc).
WD php: Warning: Cannot modify header information - headers already [warning]
sent by (output started at .../drush/includes/drush.inc:820) in
drupal_send_headers() (line 1038 of .../includes/bootstrap.inc).
FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 683 of .../modules/field/field.crud.inc).

In the hook_enable in the .install you're calling "media_type_save($type);" even if it already exists in the database... that indirectly calls media_type_configure_fields() which triggers this error on field_create_instance.

I guess there needs to be check somewhere to ensure that the field isn't already in place?

Files: 
CommentFileSizeAuthor
#77 970696_reinstall.patch1.26 KBJacobSingh
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Comments

Version:7.x-1.0-beta1» 7.x-1.0-beta2

This seems to occur in my drupal instance too. There is any workaround?

I have the same prob (with the latest dev release)

Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
Notice: Undefined index: custom settings in field_view_mode_settings() (line 631 of /home/doekbrij/public_html/drupal/modules/field/field.module).
EntityFieldQueryException: Field storage engine not found. in EntityFieldQuery->queryCallback() (line 1048 of /home/doekbrij/public_html/drupal/includes/entity.inc).

Does this info help? Mod installed all dependencies okay... when activating: this error

Cheers

Jos 2011-01-14 12:29h Switzerland time

Title:FieldException when re-enabling the moduleDisabling and re-enabling media module throws exceptions, leaves website in unusable state.
Version:7.x-1.0-beta2» 7.x-1.x-dev
Priority:Normal» Critical

Using a fresh default D7.0 site with styles-7.x-2.0-alpha4, enabling, disabling and re-enabling latest media-HEAD worked without errors for me. I think this issue is outdated, but I did not add any content or mix in the other media modules.

Best regards,
Ao

Further testing, after enabling more modules and adding content shows that enabling, adding content, disabling and re-enabling gives me this:

FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /var/www/example.com/drupal-7.0/modules/field/field.crud.inc).

This is different from the original issue, however, and my site is still usable despite the error.

Best regards,
Ao

other error when re-enabling Media Module

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'd7devlds.d7_field_deleted_data_8' doesn't exist: SELECT DISTINCT field_deleted_data_80.entity_type AS entity_type, field_deleted_data_80.entity_id AS entity_id, field_deleted_data_80.revision_id AS revision_id, field_deleted_data_80.bundle AS bundle FROM {field_deleted_data_8} field_deleted_data_80 WHERE (field_deleted_data_80.deleted = :db_condition_placeholder_0) AND (field_deleted_data_80.bundle = :db_condition_placeholder_1) LIMIT 10 OFFSET 0; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => media_gallery ) in field_sql_storage_field_storage_query() (ligne 569 in /home/www/d7dev.livreurdesexe/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

same probleme

I am having the same issue.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'DateAPITestCase-class' for key 'PRIMARY': INSERT INTO {registry} (name, type, filename, module, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => DateAPITestCase [:db_insert_placeholder_1] => class [:db_insert_placeholder_2] => sites/all/modules/date/date/tests/date_api.test [:db_insert_placeholder_3] => date [:db_insert_placeholder_4] => 0 ) in _registry_parse_file() (line 179 of /home/www/includes/registry.inc).

on activating the any module i get
PDOException: in _registry_parse_file() (line 179 of /var/www/web1266/html/drupal/includes/registry.inc).
UPDATE: this was related to Date module nad could be fixed by reinstalling Date

after that i get different PDOExceptions like SQLSTATE[42S02]: Base table or view not found: ...

site is not usable. deleting or deactivating media module makes it usable again.

I do not get any PDOException errors when disabling and re-enabling the media module. I have even re-installed my demo drupal 7.0 site a few times and tried both head and beta versions of modules.

I only get the FieldException I mentioned in #7, and the site is still usable afterwards, plus the module does get enabled in spite of the exception.

Best regards,
Ao

I retried after i solved the issue with the faulty date module install. no error on enabling media this time but PDOException on enabling media gallery and many warnings on trying to create a gallery. No time to look deeper into this at the moment. hope this could be solved, shortly.

sub, same issues for me

FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /Applications/MAMP/htdocs/ombrella/modules/field/field.crud.inc).
The website encountered an unexpected error. Please try again later.

subscribe, I have same problem

also here :)

Much the same here, 7.x-1.0-beta3 in a pretty fresh install of Drupal 7.0.

system 02/23/2011 - 10:03 media_internet module enabled. admin
system 02/23/2011 - 10:03 media_internet module installed. admin
php 02/23/2011 - 10:02 FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of E:\xampp\htdocs\iwm\trunk\htdocs\drupal-7.0\modules\field\field.crud.inc). admin
system 02/23/2011 - 10:02 media module installed. admin
system 02/23/2011 - 09:53 media module uninstalled. admin
system 02/23/2011 - 09:53 media_internet module uninstalled. admin

Can't see any immediate instability across the site but "Media Types" lists only 'other' now, originally there were 4 media types iirc... image, video etc.

Is there supposed to be an 'Add New Media Type' link/button as mentioned here http://drupal.org/node/703336 ?

Hi, I'm getting this problem using: (fresh QuickStart system and Drush)
Drupal 7.0 2011-Jan-05 Supported, Recommended, Installato
Media module 7.x-1.0-beta3 2011-Jan-15 Supported
Can't see Media Page in Contents and after get other errors on screen I disable uninstal this version
and dl and try to enable DEV version to get 1mount update code:
drush> dl media-7.x-1.x-dev
... [success]
drush> en media
The following extensions will be enabled: media
Do you really want to continue? (y/n): y
WD php: FieldException: Tentativo di creare un'istanza del campo file nel bundle default che ha già un istanza dello stesso campo. in field_create_instance() (line 488 of [error]
/home/quickstart/websites/....../modules/field/field.crud.inc).
FieldException: Tentativo di creare un'istanza del campo file nel bundle default che ha già un istanza dello stesso campo. in field_create_instance() (linea 488 di /home/quickstart/websites/......./modules/field/field.crud.inc).
Drush command terminated abnormally due to an unrecoverable error.

Got the same error.

My steps were:
Start with a fresh D7 install.
drush dl styles
drush en styles (and its other two included modules)
drush dl media
Drush reply: "There is no recommended release for project media..."
I chose beta3 from options list.
drush en media
drush dis media
drush en media
WD php: FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of [error]
/path/to/modules/field/field.crud.inc).
WD php: Warning: Cannot modify header information - headers already sent by (output started at /usr/local/src/drush/includes/drush.inc:580) in drupal_send_headers() (line 1040 of [warning]
/path/to/includes/bootstrap.inc).
FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /path/to/modules/field/field.crud.inc).

I tried producing the PHP error by starting from a fresh Drupal installation, and then enabling/disabling the module only in Drupal UI, but I could not produce the error that way.

Afterwards, I tried again to disable and then enable the module with Drush and received the error.

Noticing that Drush runs using anonymous user (at least according to log messages in Drupal UI), while I was using super user in Drupal UI, I'm wondering if this is an access issue (though I'm guessing drush is effectively running as super user, but the log results don't reflect that).

Does anyone know what drush does differently when enabling a module?

Any workaround for this?

Thank you so much.

Is there a way manually removing fields created in db to recover this
(just trying to understand looking at media.install)

I think that we shouldn'y use eval function like this and let the user enter the entire function into the admin screen. Neither we can't use the return statement

Would using the Drupal UI instead of Drush constitute a suitable workaround?

Is anyone getting the error when using the Drupal UI for module disabling/re-enabling instead of Drush?

Update:

I tried playing around with var_dump() to see if I could find differences between Drupal UI and Drush re-enabling for media module.

Drupal UI is not running into the var_dump() that I put in either hook_enable(), nor the one I put in field_create_instance() for some reason (Drush is), which explains why that method does not produce the error in this issue (though raises a question about why enabling the module in Drupal UI fails to execute hook_enable in this case).

I found no core issue on this, apologizing if I'm missing something obvious.

I have a similar problem - I disabled media, uninstalled it, and re-enabled it, and I get this:

FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /www/drupal/modules/field/field.crud.inc).

It does break the module - the first time I did this, some of the default media styles (image, video etc.) disappeared, leaving only 'other'. The second time I tried it, the media styles config menu doesn't even show on the config page.

The only line in the media module that refers to field_create_instance is in the function media_type_configure_fields() in media.types.inc.
I put a dpr($instance) just before the function call in that file, and the result was as pasted below:

Array
(
    [field_name] => file
    [entity_type] => media
    [bundle] => default
    [label] => File
    [widget_type] => file_file
    [widget] => Array
        (
            [weight] => -5
        )
    [required] => 1
    [locked] => 1
    [display] => Array
        (
            [media_preview] => Array
                (
                    [label] => hidden
                    [type] => file_default
                    [weight] => -5
                )
            [media_original] => Array
                (
                    [label] => hidden
                    [type] => file_default
                    [weight] => -5
                )
        )
)

That's about as far as I'm up for going with debugging - hope it's of some help :-)

andy (ganglion)

Have said that, I've had a go at a crude hack to media.types.inc, which was to test for existence of the instance before creating it, using the same test that's used in field_create_instance:

function media_type_configure_fields($media_type) {
  $field = field_info_field('file');
  $instance = field_info_instance('media', 'file', $media_type->name);
  if (empty($field)) {
    $field = array(
      'field_name' => 'file',
      'type' => 'file',
    );
    $field = field_create_field($field);
  }
  // Perhaps the file field exists already, if so skip.
  if (empty($instance)) {
    $weight = -5;
    $instance = array(
      'field_name' => 'file',
      'entity_type' => 'media',
      'bundle' => $media_type->name,
      'label' => 'File',
      'widget_type' => 'file_file',
      'widget' => array(
        'weight' => $weight,
      ),
      'required' => TRUE,
      'locked' => TRUE,
      'display' => array(
        'media_preview' => array(
          'label' => 'hidden',
          'type' => 'file_default',
          'weight' => $weight,
        ),
        'media_original' => array(
          'label' => 'hidden',
          'type' => 'file_default',
          'weight' => $weight,
        ),
      ),
    );
    // *** following 4 lines are changed ****
    $prior_instance = field_read_instance($instance['entity_type'], $instance['field_name'], $instance['bundle']);
    if (empty($prior_instance)) {
      field_create_instance($instance);
    }
  }
}

Unfortunately, this doesn't solve the problem - you get a new error:

Exception: Unable to set formatter preferences for default in media_type_configure_formatters() (line 73 of /www/drupal/sites/all/modules/media/media.types.inc).

I think I'll leave it there for now at least.

+1 I am having this same problem, and I had it using the Drupal UI the first time (not drush), though I was able to reproduce it using drush as well on my local).
Thanks,
-Kelly

@Scott McCabe: I'm not entirely sure, but perhaps the var_dump doesn't show up from the UI because Drupal goes through two pages when submitting (modules/list/confirm then modules/list iirc). Maybe you could use dpm() from the devel module instead?

Confirm that also with UI i get the same issue...

Thanks, aaron.

dpm() works.

Examining the reason for the watchdog difference between enable methods (i.e. via Drush where error is produced versus Drupal UI where error is not produced), while a var_dump($instance) in field_create_instance() produces proper output in Drush, the equivalent dpm($instance) in that function does not trigger output in Drupal UI.

Does anyone know why?

I got dpm($types) to work fine in media's hook_enable, but not dpm($instance) in field_create_instance().

Apparently, one enabling method triggers field_create_instance() while the other does not.

I'm going to visit irc to see if anyone can weigh in on this.

Status:Active» Needs review

I've been working on this, and started a branch for it:
reinstall_970696

Feel free to check it out. I will try to post a patch here soon once it is more complete.

I have the same issue with 7.x-1.0-beta3, when re-enable media module I get the error and can't use it anymore.

Thanks for working on this.

Juan Carlos

Same freaking problem, thanks for working on this JacobSingh

According to JacobSingh's twitter he's leaving for India, anyone else on the heals of this?

Subscribing.

For those people getting the PHP error message when using Drupal UI to re-enable the module, I have two questions:

1. Are you using the super user account (uid1) and getting the error?
2. Once you installed the media module, are you doing anything with it before re-enabling it?

I'm using uid1 and I'm not doing anything but testing install/enable and disable/uninstall media module on a fairly fresh core 7.0 (has devel, styles, and wysiwyg), and I cannot get the PHP error in Drupal UI (everything looks to work fine, at least according to dblog), but Drush (even 4.4) gives PHP error 100% of the time.

1. Yes.
2. Yes - I set up some content types to use Media. Can't remember the details, and I can't try again without reinstalling everything.

It would be helpful if you could suggest a workaround that would work in PHPMyAdmin or mysql terminal for removing the relevant tables so people can start again from scratch.

I got the same error when reenabling module, but site is working an module appeared as on switched on.
Except on one of i18 modules.

Messages:
On switch on Media module

FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /.../modules/field/field.crud.inc).

On switch Media Gallery

* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_thumbnail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_lightbox in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).
* Notice: Undefined index: media_gallery_detail in field_info_max_weight() (line 797 of /.../modules/field/field.info.inc).

On Switch on Debut media

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

On switch on Block Languages
FieldException: Cannot change an existing field's type. in field_update_field() (line 231 of /.../modules/field/field.crud.inc).

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

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

... Taxonomy translation
* Notice: Undefined property: stdClass::$i18n_mode in i18n_taxonomy_vocabulary_mode() (line 890 of /.../sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
* Notice: Undefined property: stdClass::$i18n_mode in i18n_taxonomy_vocabulary_mode() (line 890 of /.../sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
* Notice: Undefined property: stdClass::$i18n_mode in i18n_taxonomy_vocabulary_mode() (line 890 of /.../sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
* Notice: Undefined property: stdClass::$i18n_mode in i18n_taxonomy_vocabulary_mode() (line 890 of /.../sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
* Notice: Undefined property: stdClass::$i18n_mode in i18n_taxonomy_vocabulary_mode() (line 890 of /.../sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).
* Notice: Undefined property: stdClass::$i18n_mode in i18n_taxonomy_vocabulary_mode() (line 890 of /.../sites/all/modules/i18n/i18n_taxonomy/i18n_taxonomy.module).

Totally agree, the best workaround now should be givin details about a full uninstall...
cause now the only solution is fresh re-install

thank you for working on this issue

I solved this *or a similar* issue after doing a few things:

1) Installed releases and then dev version from http://drupal.org/project/media , http://drupal.org/project/media_gallery etc.
~ This caused a fair bit of grief fiddling around uninstalling and reinstalling modules etc.
2) I then followed advice another had posted and created a drupalgardens account and exported my site. I ahem, "harvested" the Media, Media Gallery modules from my drupalgardens download and uploaded them to the usual spot on my site.
~ Still having issues due to database structure form previous installs and patchy uninstalls ~
3) With a *fresh* site I enabled Media module and then replaced the table media_type by exporting it from my fresh site and importing it into my troublesome site.

All seems to be fine now.

So:
b) Use phpmyadmin
b) Compare and contrast
c) Always backup!

subscribing.

Just found this noteworthy comment on the Drupal Commerce Module project page (http://drupal.org/project/commerce):

"WARNING: Due to core issues regarding menu rebuilding and field disbaling, the uninstall process has not been resolved. Please use caution when installing and/or be prepared to wipe and rebuild your site. Follow #858722: The uninstall routines should delete previously created fields for updates on the process."

"Core issues regarding field disabling" - perhaps the cause of the uninstall problems are caused by Core and not by Gallery Module?

Yeah, we have exactly the same issue :( I'll be working on this later today to see if we can't get something working.

I wonder how much change will be in the 7.1 release of Drupal?

subscribing

I notice that the media module creates the table "field_data_file".

When the uninstall process is run, while all other media-module-created tables are automatically removed (as the uninstall hook is supposed to do), that table is not removed, since it is not defined in schema hook.

Apparently, this is proper Drupal behavior, according to Drupal API (http://api.drupal.org/api/drupal/modules--system--system.api.php/functio...) -- "Database tables defined by hook_schema() will be removed automatically."

It is perfectly reasonable to conclude that all tables created by a module should be removed upon uninstall.

Why not simply use db_drop_table('field_data_file') in media module's uninstall hook?

If that function is bad form, is there a proper Drupal way to drop that table?

I just posted a question in #drupal-contribute about why tables defined by schema field hook are not auto dropped too.

My post to #drupal-contribute pointed us to:

http://drupal.org/node/943772#comment-4197688

subscribing

subscribing

This really is a big problem. I was working on a simple test site when I ran into this issue. As it was just a test site I decided to see what it takes to get the Media module working again. I do not recommend this to anyone but here are the steps I took:

  1. Disable and uninstall the Media module. This cleans most of the Media related stuff from the database.
  2. Drop all field_data_field_<media field> and field_revision_field_<media field> tables.
  3. Drop the field_data_file and field_revision_file tables.
  4. Delete all media and file field rows from the field_config and field_config_instance tables. (I'm not sure if this is really necessary. I just wanted to make sure there were very little traces of the Media module left in the DB before re-enabling the module once again.)

During the process I frequently disabled and re-enabled the Media module with drush to see if the module was working or throwing some meaningful exceptions. After I did all the things listed here the module started working again and I have yet to experience any further problems with it. The fix sure was ugly, though.

I ignored the caveats (because I enjoy living dangerously, and because Media is pretty much unusable to me currently) and tried Kimitri's instructions above. It looks like maybe I deleted too much:

FieldException: Attempt to create an instance of a field file that doesn't exist or is currently inactive. in field_create_instance() (line 455 of ../modules/field/field.crud.inc).

Oops.

Once I fix that, I'll continue trying to find a streamlined way to cleanly uninstall/reinstall. I'll post what I find out here.

Subscribe.

Subscribe

Kimitri's workaround instructions in #51 seem to work. The error I reported in #52 was fixed by disabling and re-enabling the module twice after the final step.

I've been able to get a munged Media install working again multiple times today using this process. Your mileage may vary.

Sub

Getting the same error but on a fresh install of D7 & when trying to install Media (beta3 & dev)

FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of /var/www/d7/modules/field/field.crud.inc).

As per #51 (3) deleting field_data_file and field_revision_file tables fixed the error permanently, since it is fresh install, other steps are not needed.

Getting the error because conflict of field when trying to enable Debut Article.

This is relevant to my interests

I got the same message as in #57 after disabling Media. I had no Media data in my system.
After checking the fields in table file_managed, I removed the lines with existing fields in media.install file:
<?php
// Alter {file_managed}.type and add it as an index.
- db_add_field('file_managed', 'type', _media_type_field_spec());
db_add_index('file_managed', 'file_type', array('type'));
>?

subscribe

This isn't complete yet, but could someone who is interested participate in reviewing http://drupalcode.org/project/media.git/shortlog/refs/heads/reinstall_97...

If you don't know how to use git, see the git instructions page: http://drupal.org/project/media/git-instructions

basically just:
git clone --branch reinstall_970696 JacobSingh@git.drupal.org:project/media.git

That will check out the media repo and set it to be using this experimental branch. Please help review! This is a community priority and one of things we want to tackle in #1117860: [META] April Media sprint, but it won't happen w/o your support reviewing and testing.

Best,
Jacob

I was was to install, disable, uninstall, and then re-install with the UI interface without problems.

With drush, on the re-install, i got the following errors output:
( i actually get this error on most drush commands after uninstalling, e.g. status, sa, cc, etc )

[eric@EricsMBP drupal]$ drush dis media
The following projects will be disabled: media
Do you really want to continue? (y/n): y
media was disabled successfully.                                                                             [ok]
[eric@EricsMBP drupal]$ drush uninstall media
Warning: The command name "uninstall" is deprecated.  Please use a recommended form instead (pm-uninstall).  [warning]
The following modules will be uninstalled: media
Do you really want to continue? (y/n): y
media was successfully uninstalled.                                                                          [ok]
[eric@EricsMBP drupal]$ drush en media
WD php: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.type' in 'field list':    [error]
SELECT base.fid AS fid, base.uid AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS
filemime, base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp, base.type AS type
FROM
{file_managed} base
WHERE  (base.fid IN  (:db_condition_placeholder_0)) ; Array
(
    [:db_condition_placeholder_0] => 0
)
in DrupalDefaultEntityController->load() (line 196 of
/Users/eric/drupal7-test/drupal-7.0/includes/entity.inc).
WD php: Warning: Cannot modify header information - headers already sent by (output started at               [warning]
/opt/local/share/drush/includes/drush.inc:820) in drupal_send_headers() (line 1040 of
/Users/eric/drupal7-test/drupal-7.0/includes/bootstrap.inc).
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column &#039;base.type&#039; in &#039;field list&#039;: SELECT base.fid AS fid, base.uid AS uid, base.filename AS filename, base.uri AS uri, base.filemime AS filemime, base.filesize AS filesize, base.status AS status, base.timestamp AS timestamp, base.type AS type
FROM
{file_managed} base
WHERE  (base.fid IN  (:db_condition_placeholder_0)) ; Array
(
    [:db_condition_placeholder_0] => 0
)
in DrupalDefaultEntityController->load() (line 196 of /Users/eric/drupal7-test/drupal-7.0/includes/entity.inc).
Drush command could not be completed.                                                                        [error]
Drush was not able to start (bootstrap) Drupal.                                                              [error]
Hint: This error can only occur once the database connection has already been successfully initiated,
therefore this error generally points to a site configuration issue, and not a problem connecting to the
database.
Drush was attempting to connect to :
  Drupal version    : 7.0
  Site URI          : http://default
  Database driver   : mysql
  Database hostname : localhost
  Database username : d7test
  Database name     : d7test
  Database          : Connected
  Default theme     : bartik
  Administration theme: seven
  PHP configuration : /Applications/MAMP/conf/php5.2/php.ini
  Drush version     : 3.3
  Drush configuration: /Users/eric/.drush/drushrc.php
  Drupal root       : /Users/eric/drupal7-test/drupal-7.0
  Site path         : sites/default
  Modules path      : sites/all/modules
  Themes path       : sites/all/themes
  File directory path: sites/default/files
  Private file directory path:
  %paths            : Array
You can select another site with a working database setup by specifying the URI to use with the --uri
parameter on the command line or $options['uri'] in your drushrc.php file.

Thanks for your efforts on this Jacob.

Thanks for the response and the test! I'll look into this today.

I still get:

FieldException: Attempt to create an instance of field file on bundle default that already has an instance of that field. in field_create_instance() (line 488 of .../modules/field/field.crud.inc).

Status:Needs review» Needs work

Damn... I get #62 after uninstalling. I'm not sure what's trying to run that query... going to try and track it down.

mybe this would help in som eissues:
http://drupal.org/node/1031956

subscribe

sub

subscribe

Status:Needs work» Postponed

This will be better resolved when we complete #1086958: Switch from Media Entity to File Entity and get that merged into the 7.x branch.

subscribing

tried #68 but it did not help. This is a fatal flaw & should be mentioned BIG BOLD TEXT on the project homepage. Thereby providing the same courtesy warning that the Commerce maintainers provide.

Subscribe

I installed beta-4 today, ran update.php and admin/config/media/rebuild_types, and gave me no problems anymore.
However, now Media Gallery gives WSOD upon instalation.
IMO this issue is/can be resolved, but check out those related issues:
#999530: Upgrade Media Gallery for Media's new File Entity (EntityFieldQueryException: Field storage engine not found)
#1015580: Media entities : Cannot access empty property in field.attach.inc line 677

Issue tags:+media, +re-install

I had the same problem when I upgraded to version beta4.
Follow the steps in post #51 but it was also necessary to delete the column 'type' in table file_managed.
Then just install again.

Status:Postponed» Active

Ref. #70 - "#1086958: Switch from Media Entity to File Entity"
- is now fixed, so removing the postponed status.

Status:Active» Needs review
StatusFileSize
new1.26 KB
PASSED: [[SimpleTest]]: [MySQL] 0 pass(es).
[ View ]

Here's a new patch.

subscribe

subscribe

This is the only module preventing me from setting up a new client in Drupal 7..

drush and UI uninstall works for me.

Latest patch fixed all issues using the UI.

Question: So the Styles (file styles) module is not longer used? I noticed when I installed this new version with the patch the Styles module became disabled. Yes?

+1

Status:Needs review» Fixed

Committed #77 to 7.x-1.x, so it should show up in 12 hours or so in the dev snapshot release.

I don't know if it fixes all paths that led to this bug, so if you still discover problems related to disabling / uninstalling, please re-open this issue, with a comment explaining how to trigger the bug that you see.

So the Styles (file styles) module is not longer used? I noticed when I installed this new version with the patch the Styles module became disabled. Yes?

Correct. See #1086958-25: Switch from Media Entity to File Entity for details. The Styles module shouldn't become disabled though, if you already have it enabled. It's just no longer a dependency, so it doesn't get automatically enabled when you enable Media.

Note that Media Gallery and some other modules are not yet compatible with the dev snapshot, so if you're using those modules, you may need to stay on beta4 until they've been suitably updated. I added this info to the top of the Media project page.

Status:Fixed» Needs review

subscribe

Status:Needs review» Fixed

#86 was probably a x-post, so resetting status. If the status change was intentional, please explain.

newb, my apologies.

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Can this ticket be reopened? I am having the same problem with 7.x-1.0-rc2.

For some reason, it only happens on my production site -- yikes! Oddly, when I backup and migrate a snapshot of the production DB to a staging area (with the same code in both environments), I don't have this problem in stage. Activating the Media module in production however breaks my site in a bad way.

It's also seemed to cause other instabilities, even after I got the "unexpected error" to go away. Publishers have been getting "Fatal error: Call to undefined function file_field_widget_form()" when trying to post content.

I have solved this problem by inserting a row in taxonomy_term_data_table.
row: 5;7;Galleries;'';plain_text;0

vid must be the same as vocabulary id in taxonomy vocabulary