RouterOS reports "no such item" - when item clearly exists

I am testing /interface/pppoe-server/remove via the API, which means I am calling it over and over.

I noticed that when I first boot my MikroTik, I can manually kick my PPPoE user without issue – note this is interactive:

[admin@BOMA_lab] > /ppp active print
Flags: R - radius
 #   NAME         SERVICE CALLER-ID         ADDRESS         UPTIME   ENCODING
 0 R andristhe... pppoe   D4:CA:6D:04:C0:14 0.0.0.0         51s

[admin@BOMA_lab] > /interface pppoe-server remove
numbers: 0

…works great, the user’s PPPoE session restarts.

After hitting the API maybe 20+ times (i.e. testing my own code), something goes awry in RouterOS. Note this is another interactive prompt, doing the same as above – but different results:

[admin@BOMA_lab] > /ppp active print
Flags: R - radius
 #   NAME         SERVICE CALLER-ID         ADDRESS         UPTIME   ENCODING
 0 R andristhe... pppoe   D4:CA:6D:04:C0:14 0.0.0.0         5m13s

[admin@BOMA_lab] > /interface pppoe-server remove
numbers: 0
no such item (4)

I’ve seen this on 6.20 and 6.27.