```python
"""Walks a courier relay directory station by station."""


def trace_relay(links: dict, start: str) -> list:
    """Walks a courier relay directory station by station.

    Returns a list of station names visited in hand-off order, from start
    through the terminal station inclusive. The relay ends when a link points
    to an empty string or to a station not present in the directory.

    Raises ValueError if the start station is not a string, not in the
    directory, or if the start is an empty string. Raises ValueError if a
    link points to a station not present in the directory or if a station
    is visited more than once (cycle detection).
    """
    if not isinstance(start, str):
        raise ValueError("start must be a string")
    if start == "":
        raise ValueError("start cannot be an empty string")
    if start not in links:
        raise ValueError("unknown starting station")
    if not isinstance(links, dict):
        raise ValueError("links must be a dictionary")

    path = []
    current = start
    visited = set()

    for _ in range(len(links)):
        if current in visited:
            raise ValueError("relay chain contains a cycle")
        visited.add(current)
        path.append(current)
        target = links[current]
        if target == "":
            return path
        if target not in links:
            raise ValueError(f"link to station '{target}' is not in the directory")
        current = target

    return path
```