public static NotControllerException newPreMigrationException(OptionalInt controllerId) {
        if (controllerId.isPresent()) {
            return new NotControllerException("The controller is in pre-migration mode.");
        } else {
            return new NotControllerException("No controller appears to be active.");
        }
    }
Create a new exception indicating that the controller is in pre-migration mode, so the
operation cannot be completed.

@param controllerId      The current controller.
@return                  The new NotControllerException.
metadata/src/main/java/org/apache/kafka/controller/errors/ControllerExceptions.java