Most likely you have incorrect or missing data in your database. There could be many causes of this. I'd suggest using the SQL profiler to trace what happens in this case and look for error messages in the logs. If there is an error message present in the logs try to find which SQL query that you traced with the profiler caused it.
Credits to abrasive for writing this.
Here is a link just in chase you get a other error