We've recently evolved two types that are for similar purposes:
In Tomislav added the MigrationInvalidStateException to indicate that a migration is referring to a state that does not exist.
In Aris added the MissingReferenceException which is a more generic exception to indicate there is a reference to some resource that does not actually exist. uses this to indicate references to non-existant groups.
There will likely be many more cases where we need to check the integrity of references like this. The generic MissingReferenceException looks like the way to go so we should refactor the MigrationInvalidStateException uses to use MissingReferenceException.
MissingReferenceException also needs the following enhancements:
Include structured meta data about the type
Currently the "ref" (ID or name) is passed into the message - there should be an actual getRef() property.
Include the type of the resource that is being referenced (assertionGroup, state, etc)
Include the type and ID of the referrer.
Improve the name slightly - InvalidReferenceException.
An outline of the type is:
class InvalidReferenceException extends Exception