Nested Set Error while Uploading Image in Attach Image Field

I am facing Nested Set Error and sometimes deadlock occurs while uploading Image.

Can anyone help me what might went wrong.

Here’s the error which I’m getting while uploading image. Sometimes it occurs sometimes it won’t.