I had the same problem.
The error was caused by the database. I imported the posts (also existing posts). But this import also made new records in the wp_postmeta table with a postid 0.
After running this query the problem was fixed:
DELETE FROM wp_postmeta WHERE post_id = 0