Unable to clear mission using mavlink

I am testing the codes in SITL simulator. I used this command to clear missions in ardupilot before loading new missions.

the_connection.mav.mission_clear_all_send(1,1,0)

The mission types are all Mission.

After doing this a number of times. There will comes a problem where it will not be able to clear mission anymore.
It will comes with
MAV_MISSION_ERROR

I tried clearing
the_connection.mav.mission_clear_all_send(1,1,255)
It comes with error 3 which says the command is unsupported

Anyone knows why the Mission Clear all command will generate errors after a few try

Please report a bug in github

Anyway I had a workaround solution. I will post the error in Git

All I did was just overwrite new missions into ardupilot instead of clearing old missions and writing in. It seems to do the trick.