Answers.Body: <p>Turns out this was because several tables were missing the MySQL auto-increment flag for their <code>id</code> integer primary keys.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-30T23:48:36.193Z
Answers.LastActivityDate: 2016-04-30T23:48:36.193Z
Answers.UserDisplayName: Brad Bell
Body: <p>I receive the following error only when I clear the cache:</p>
  
  <p><a href="https://i.sstatic.net/UcEbV.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/UcEbV.png" alt="enter image description here"></a></p>
  
  <p>When I try to rebuild the image index, all of my image paths go missing.
  I'm not sure what caused this error but I do need to fix it.</p>
  
  <p>I've checked my image transforms and everything is named correctly. I even tried to delete and re-add and still nothing. I'm getting this same error on another one of my craft sites when I empty the cache.</p>
  
  <p>I have no idea what's causing it.</p>
  
  <p>I did come across this post:
  <a href="https://craftcms.stackexchange.com/questions/14739/cdbexception-column-not-found">CDbException: Column not found</a></p>
  
  <p>I read through the comments but no solution has been posted. I did a db search for CONSTRAINT or FOREIGN KEY and have both.</p>
  
  <p>Any and all help is appreciated.
  Thanks in advance.</p>
  
  <hr>
  
  <p>UPDATE!!!</p>
  
  <p><strong>Things I tested and found</strong>:</p>
  
  <p>I looked at the assettransformindex in the database and it was empty.</p>
  
  <p>I ran an INSERT statement to populate the rows with proper information - it inserted successfully.
  I refreshed the site, the CBd exception was gone.</p>
  
  <p>I cleared the cache, minus the image transform index and the site still worked perfectly.</p>
  
  <p>I cleared the cache with image transform index selected and it stripped everything from the DB.</p>
  
  <p>If I try to upload an asset that uses the transform, it throws the CBd exception again and clears the DB.</p>
  
  <p>I hope this information helps...
  Thank you in advance.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-28T23:56:04.590Z
Comments.Text: My guess is there is an asset source path not setup somewhere correct.  Can you upload Asset successfully though the asset index page?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T01:44:35.737Z
Comments.Text: Hi Brad. I'm able to upload an asset through the asset index page. I just double checked the asset paths and they all appear correct. When I try to update the asset index, I get the following error: "The following files could not be found. Should they be deleted from the index?" -- but those assets are all accessible from the front-end.
Comments.UserDisplayName: Leyla Badillo
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T16:52:41.030Z
Comments.Text: Hrm... might be easier if you shared your file system directory structure and how you've got your local Asset sources defined.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T21:00:16.853Z
Comments.Text: @BradBell can I send you a copy of the site + db? If so, how can I send that info to you?
Comments.UserDisplayName: Leyla Badillo
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-29T21:31:37.297Z
Comments.Text: If you want to zip them up and send them to support@craftcms.com, we can take a look at them.
Comments.UserDisplayName: Brad Bell
Tags: <assets><database><assetfilemodel>
Title: CBdException: Column 'id' cannot be null
ThreadText: # CBdException: Column 'id' cannot be null
  
  (Asked by: username_0 on 2016-04-28)
  
  I receive the following error only when I clear the cache:
  
  [![enter image description here](https://i.sstatic.net/UcEbV.png)](https://i.sstatic.net/UcEbV.png)
  
  When I try to rebuild the image index, all of my image paths go missing.
  I'm not sure what caused this error but I do need to fix it.
  
  I've checked my image transforms and everything is named correctly. I even tried to delete and re-add and still nothing. I'm getting this same error on another one of my craft sites when I empty the cache.
  
  I have no idea what's causing it.
  
  I did come across this post:
  [CDbException: Column not found](https://craftcms.stackexchange.com/questions/14739/cdbexception-column-not-found)
  
  I read through the comments but no solution has been posted. I did a db search for CONSTRAINT or FOREIGN KEY and have both.
  
  Any and all help is appreciated.
  Thanks in advance.
  
  ---
  
  UPDATE!!!
  
  **Things I tested and found**:
  
  I looked at the assettransformindex in the database and it was empty.
  
  I ran an INSERT statement to populate the rows with proper information - it inserted successfully.
  I refreshed the site, the CBd exception was gone.
  
  I cleared the cache, minus the image transform index and the site still worked perfectly.
  
  I cleared the cache with image transform index selected and it stripped everything from the DB.
  
  If I try to upload an asset that uses the transform, it throws the CBd exception again and clears the DB.
  
  I hope this information helps...
  Thank you in advance.
  
  **Tags:** assets, database, assetfilemodel
  
  > **Comments:**
  > **username_1**: My guess is there is an asset source path not setup somewhere correct.  Can you upload Asset successfully though the asset index page?  
  > **username_0**: Hi username_1. I'm able to upload an asset through the asset index page. I just double checked the asset paths and they all appear correct. When I try to update the asset index, I get the following error: "The following files could not be found. Should they be deleted from the index?" -- but those assets are all accessible from the front-end.  
  > **username_1**: Hrm... might be easier if you shared your file system directory structure and how you've got your local Asset sources defined.  
  > **username_0**: @username_1 can I send you a copy of the site + db? If so, how can I send that info to you?  
  > **username_1**: If you want to zip them up and send them to support@craftcms.com, we can take a look at them.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-04-30. Score: 1
  
  Turns out this was because several tables were missing the MySQL auto-increment flag for their `id` integer primary keys.
  
  
  ---
  
  