'Context is incorrect' error when using 'bpy.ops.object.mode_set(mode='OBJECT')' if I'm already in object mode
You can check which mode you're in with the following line:

mode = context.active_object.mode


And then do things correspondingly, such as switching to object mode when you're in pose mode for example.

Or you could use a try/except statement:

try:
    bpy.ops.object.mode_set(mode='OBJECT')
except:
    pass


Hope this helps.