def toListOfPairs(s):
    """
    Convert a spaces-separated string to a list of pairs.
    Raise ValueError if the list length is not even.

    >>> toListOfPairs('a b c d e f')
    [('a', 'b'), ('c', 'd'), ('e', 'f')]
    """
    items = s.split()
    if len(items) % 2:
        raise ValueError('input must contain even number of entries')
    return list(zip(items[::2], items[1::2]))
