I get an error like the following and a white-screen, after updating from version 7.x-1.3 to 7.x-1.4 via drush, due to :

WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mysite.image_dimensions' doesn't exist: SELECT * FROM {image_dimensions} id WHERE id.fid IN (:fids_0); Array[error]
[:fids_0] => 7
in file_entity_file_load() (line 225 of /home/mysite/public_html/sites/all/modules/media/file_entity/file_entity.module).

Uncommenting all accesses to that table rendered the site usable again, but that kind of defeats the purpose.

Thanks for providing a proper migration path!


#41 image_description_update-1882292-41.patch1.2 KBben.kyriakou
PASSED: [[SimpleTest]]: [MySQL] 62 pass(es). View
#30 media-n2170231-30.patch694 bytesDamienMcKenna
PASSED: [[SimpleTest]]: [MySQL] 62 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


Dave Reid’s picture

Did you update the File entity module too? Which version are you using?

museumboy’s picture

I'm getting same exact error. I've asked my system admins if they updated anything.

Error message

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nysm.image_dimensions' doesn't exist: SELECT * FROM {image_dimensions} id WHERE id.fid IN (:fids_0); Array ( [:fids_0] => 3 ) in file_entity_file_load() (line 225 of /mysite/htdocs/sites/all/modules/media/file_entity/file_entity.module).
The website encountered an unexpected error. Please try again later.

emettler’s picture

Same bug - had to roll back to 7.x-1.3.

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'pantheon.image_dimensions' doesn't exist: SELECT * FROM {image_dimensions} id WHERE id.fid IN (:fids_0); Array ( [:fids_0] => 1256 ) in file_entity_file_load() (line 225 of /srv/bindings/e256e388c1704267b32ddd319c4e8106/code/sites/all/modules/media/file_entity/file_entity.module).

emettler’s picture

And yes - I updated the File Entity module too - tried rolling that back - error was still there. Rolled back Media and that fixed. Entity is back to the latest version with no issues.

Dave Reid’s picture

If you are using Media 7.x-1.x, I'll repeat what both project pages say, you *cannot* use the separate File entity project and must use the File entity module that is contained inside the Media project. Only if you are using Media 7.x-2.x should you download and install the separate File entity module.

wellyrm’s picture

I solved the problem on my site.

Just do what Dave Reid says >> If you are using Media 7.x-1.x, use File entity that included in module.

When this problem appear, my site using file_entity from separate module and this problem occur. Then I uninstall media and file_entity module also remove the file_entity from modules folder and re-install media module. And then my site normal again.

Don't forget backup your site first.

pete-b’s picture

The above wasn't working for me, probably because I previously had media 2.x and uninstalled it (and the standalone file_entity module) though something was still lingering preventing the schema update.

Calling the schema update manually worked for me in this case:

// Bootstrap drupal... (or use drush scr)

module_load_include('install', 'file_entity');

stefnes’s picture

same bug but with previously updated entity API 1.2 to 1.3 .
I 've no File_entity module separated from Media in my site... why I keep the same bug ?

cutmedia’s picture

same issue, rolling back to media 1.3 fixes it

paul.berlin’s picture

I have the same error as MaxF and museumboy.

The solution of wellyrm (uninstall module media) I can not use because it is not possible. I would loose my media galleries.

I tried the solution of pete-b but I get the error:
Fatal error: Call to undefined function module_load_include() in sites/default/settings.php on line 459

Any help?

pete-b’s picture

@paul.berlin sounds like drupal is not fully bootstraped when you run the script, this article might help you:


paul.berlin’s picture

@pete-b thanks.
No the new version of media works fine.

webatelier’s picture

Same issue here with prior update of Entity API to 1.3
No separate file entity module installed ...
Had to roll back to Media 1.3 to fix this
Tried twice to upgrade to media 1.4 with same issue every time ...

sbgranny’s picture

Same issue as #13. Had to roll back to Media 1.3

Eric Tiggemann’s picture

For me it worked to just replace the folder file_entity in the media module with its 1.3 version by leaving the rest of the media folder content on 1.4.

I will be somewhat more cautious with the coming upgrade for the Media module then anyhow I am.

Beulette’s picture

I think I've found the solution for some of you

I had the same problem, and I used a 2.x version of Media in the past too.

In the database, in the table named 'system', the line with column 'name' value was 'file_entity' had its "schema_version" column value at 7104.
this is in the database where informations about modules versions are stored

The .install file was containing the 'file_entity_update_7101' fonction to create the table needed, {image_dimensions}.

 * Create the {image_dimensions} database table.
function file_entity_update_7101() {
/* */

So, one of these informations were false : when the update script is launched, it will search for a 'field_entity_update_####' function with version number higher thant 7104. So it won't launch the function with 7101 version number.

I think the "7104" value was created by the old Media 2.x version I used 1 or 2 years before.

So I solved the problem by changing the database value "schema_version" from "7104" to "7100", so that the update function will be considered. Then I launched the update.php, and the table was created.

Other solution would be to change the function name in file_entity.install, from "file_entity_update_7101" to "file_entity_update_7105". But not a good idea : you may have to do the same with every new version. Only use it if you can't access to your database.

webatelier’s picture

yes !
seems #16 solved it for me too
although i had an other value than 7104 (think it was 7125 or 7225)
also had media2 installed previously, so ... this it probably was caused it
thx Beulette !

dalehgeist’s picture

So...where can you find Media 1.3? Right here: https://drupal.org/node/1931764

Ivan_Dagreat’s picture

#16 Worked for me. But my `schema_version` was "-1". So I still set it to "7100" then ran (drush updb) and the table was created.

Also, When I went back to Media-7.x-1.3 (drush dl media-7.x-1.3) it worked but I wanted to use the newer version of Media.

Thanks for all the comments.

siramsay’s picture

#16 worked for me too, exactly same error as started this thread, thanks

my schema version was 7212

i manaully run
UPDATE `MY_DATABASE_NAME`.`system` SET `schema_version` = '7100' WHERE `system`.`filename` = 'sites/all/modules/media/file_entity/file_entity.module';


creeksideplayers’s picture

Thanks, size, #20 worked for me. I think I loaded file_entity 2.x at one time but later uninstalled it. I wonder why that database entry wasn't removed when I did the uninstall.

akeimou’s picture

haven't tried 2.x so #15 worked for me

jsiesquen’s picture

I'm restore Media 7.x-1.3 module, replace the folder only and now work!

The #15 work for me!

labboy0276’s picture

I can confirm #20 worked for me also. This client must have had the standalone file_entity with their media 1.x branch at some point. Thanks.

GerardoD’s picture

My system table, under the name column did not have file_entity

GerardoD’s picture

solution #15 worked for me.

bkno’s picture

Update query in #20 fixed it for me on a complex site I inherited. Thanks!

drupalninja99’s picture

We need a patch that just fixes the update number to file_entity_update_7105 (or some other number)

Anybody’s picture

#16 worked for me to. A safe solution is required!

DamienMcKenna’s picture

Version: 7.x-1.4 » 7.x-1.x-dev
Status: Active » Needs review
694 bytes
PASSED: [[SimpleTest]]: [MySQL] 62 pass(es). View

Here's a patch that will actually resolve the problem.

cameronbprince’s picture

#30 works well.

Greg Boggs’s picture

#30 did not work for me.

There are still no pending database updates after applying the patch.

CocoSkin’s picture

I was using "File Entity 7.x-2-alpha3" and "Media 7.x-1.4", which have the big issue.
Then I roll back "Media 7.x-1.3" and removed "File Entity 7.x-2-alpha3", which solve the problem for uploading files.
And then, I path #30(media-n2170231-30.patch) after upgrading from "Media 7.x-1.3" to "Media 7.x-1.4", which created the same error again.

Carlos Miranda Levy’s picture

Patch on #30 works fine.

From your Drupal root, follow this on Linux shell...

Download the new media module (drush up will crash, so download it manually).

cd sites/all/modules
sudo rm -rf media
wget http://ftp.drupal.org/files/projects/media-7.x-1.4.tar.gz
tar -zxvf media-7.x-1.4.tar.gz
rm media-7.x-1.4.tar.gz

then download and apply the patch...

cd media/file_entity
wget https://drupal.org/files/issues/media-n2170231-30.patch
patch < media-n2170231-30.patch

then run update.php from the browser or

cd ../../../../yoursite
drush updb
anthonylindsay’s picture

Trying to upgrade from 1.2 to 1.4 I got the image_dimension table errors. I solved it by instead of using drush up as I might normally do, I:

  1. downloaded media 1.4,
  2. deleted media 1.2 from my site structure,
  3. moved media 1.4 into its place
  4. ran drush updb

and hey presto, it worked flawlessly.

In my case, it appears that drush up was at fault, rather than media module.

CocoSkin’s picture

@Carlos Miranda Levy #34. Did you installed "File Entity" 7.x-2.0-alpha3 before? If not, then that's different. This Patch would not work for anyone who has installed "File Entity" 7.x-2.0-alpha3, even after we removed.

adshill’s picture

Just to mention that #16 worked for me :)

Xagarsan’s picture

Solution #13 was correct for me. Install Media 7.x-1.3 and the error disappeared

joneldesouza’s picture

Patch on #30 works fine.

megabox’s picture

El parch del #30 funciono perfecto siguiendo las indicaciones del #34 Gracias! (thanks!)

ben.kyriakou’s picture

1.2 KB
PASSED: [[SimpleTest]]: [MySQL] 62 pass(es). View

I've experienced this error, and rolled a patch that will allow you to run the update. This isn't particularly extensively tested, so I'd suggest running the update then reverting to vanilla 7.x-1.4.

After some debugging I found that file_entity_file_load() was being called from revisioning_node_load(), but may equally be called any time a node is loaded resulting in hook_file_load() being called. This prevented me from running update.php (or drush updb), since drupal_path_initialize() loaded my homepage (which is a node) in the background when visiting update.php.

Although this isn't specifically a Media bug, it's fairly likely you'll have this issue if you use nodes and/or have one as your homepage. It would be nice if not having this database didn't cause a fatal error when hook_file_load() is called.

mikelaroy’s picture

#15 worked for me. Thanks dalehgeist for giving us a link to that version.

jordan8037310’s picture

#16 worked for me, thanks!

frederico’s picture

#16 also worked for me. Thanks to Beulette !!!

steinmb’s picture

Status: Needs review » Postponed (maintainer needs more info)

Read through the issue and it is hard to understand how to reproduce this or if there is anything to test. To me seem this issue to be mostly people mixing up 7.x-1.x and 7.x-2.x of media and file_entity and no real bug in hook_update_N() to file_entity. The classical thing would be people that do:

drush dl file_entity -y
Project file_entity (7.x-2.0-beta1) downloaded to ...

To get fieldable files in drupal. After using that for a while then decide that they also need the media module:

drush dl media
Project media (7.x-1.4) downloaded to ...

This will not work. file_entity-7.x-2 need media-7.x-2

I find nothing to commit and no bugs here. Suggest we close this issue and move on.

zanndoth’s picture

I have the same error and both Media and File Entity are using 1.4. Here's the strange thing. I'm using a single drupal setup to host multiple domain names using different tables. It works fine on the main website but I have this error on all the other domains.

Edit: It's not funny how the answers always occurs to me after I post a problem. Manage to solve my issues by updating all the database individually.

steinmb’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

Closing issue. See #45 for more info.

r2coder’s picture

Thanks all. Following the steps for #16 works. I'll test the patch on another server - just needed a quick fix for this.

elkz’s picture

#16 worked ! thanks !!

Todd Zebert’s picture

#16 worked for me

francoisleralle’s picture

I got the same problem and manage to solve it by first upgrading from 7.x-1.3 to 7.x-1.4 and then from 7.x-1.4 to 7.x-1.5 using drush pm-update

drush up media-7.x-1.4
drush up media-7.x-1.5
jonathanlauer’s picture

#16 worked for me !!! thanks :) 1 hour loose to find that

msaddamalam’s picture

i'm facing a problem while clicking on a menu link with this error.
databasename.image_dimension table not exit.
i understand this problem but can't resolve it.
kindly help me i need to submit my project urgently.

any one know image dimenstion tablea fields and datatypes of it.
so that i create this table manually.

BrightBold’s picture

Patch in #30, followed by rerunning update.php, solved the problem for me.

Contrary to what's claimed in #45, I do not believe the site where I'm having this problem ever had any version of Media or File Entity 2.x installed. I encountered this problem when I upgraded to Media 1.4.

GAtherton’s picture

#16 solved this for me.
I was using Media 1.5

My schema version was set to 7216 in systems table. Edited to 7100, ran updates. Update reported that image_dimensions table needed to be constructed. On continuing table was constructed, error now gone.

In .install function media_update_7216 was explicitly disabled. After update there is no such function.

I don't remember using Media 2 - this fault appeared recently and media has been installed for well over a year, updated in May 2015.

I had noticed image upload via the media button on ckeditor was broken some time ago and now it is working so perhaps that indicates that the problem was long standing, but a recent update somewhere revealed the recent error (only reported when I tried to access the admin/content, everything else was working)?

Thanks to Beulette for this fix

MariaIoann’s picture

#16 and #19 worked for me too.

IrishAdo’s picture

I couldn't get #16 to work for me as the value in the database was 7126 at this time so I built the table manually FYI I didn't add the foreign key

CREATE TABLE `eque2`.`image_dimensions` (
PRIMARY KEY (`fid`),