I also came across this error. For me, it would appear when I tried to write or update either a post or a Page. LisaHartjes solution:
The default category still wasn’t checked, so I went back in, checked the settings on the Writing tab under Options, then saved it, and the default is checked again.
worked for me, although I don’t know why it was affecting Pages as well as posts. My advice to anyone seeing this error is to write a new post, and see if any of the categories are checked by default. If not, that’s your problem and the solution is above. I, unlike LisaHartjes, didn’t need to change any ! in post.php, and I’m not even sure where she made that change.