An error occurred while sending command to MapSegmentEditCapability: Failed to split segment. Both ends of the cutting line need to be connected with a wall surrounding the chosen segment.

This is an overly verbose error which took way too long for me to understand.

The error occurs when you’re trying to create a segment that is not fully enclosed. There is likely a hole in the wall somewhere (either real or hallucinated by the robot) which leads to the same segment.