A key-value store has read and write operations. Someone needs a read-only version for a mounted snapshot, so they subclass the in-memory store and make set throw.
It type-checks. Anywhere a KvStore is accepted, a read-only one is accepted too. But saveMarkerBad was written against a promise: you can write to a KvStore. The subclass broke that promise, and nothing says so until the code runs.