This is likely to be because one of the posts has a parentid which does not match the postid of another post, perhaps because of some manual table editing that was done (such as deleting rows), or it could just be a data inconsistency that crept in somehow. If you like, these are "orphaned" rows.
In any event you can find the problematic rows using this query:
select child.postid,child.parentid,parent.postid from qa_posts as child left join qa_posts as parent on parent.postid=child.parentid where parent.postid is null and child.parentid is not null;
The output from that might show some rows with a non-NULL second column, and a NULL third column. Those represent rows in the qa_posts table which have a parentid that doesn't match any other post.
You can delete those rows, using the first column of the output, which is their postid.