```python
"""Replay a notepad editing session: type, erase, replace, undo and redo."""

def replay_notepad(commands: list) -> str:
    buffer = ""
    past = []
    future = []

    def validate_command(command):
        if not isinstance(command, list) or len(command) != 2:
            raise ValueError("Command must be a list of two elements.")
        action = command[0]
        if action == "type":
            if not isinstance(command[1], str) or not command[1]:
                raise ValueError("Type command must have a non-empty string.")
        elif action == "erase":
            if not isinstance(command[1], int) or command[1] <= 0:
                raise ValueError("Erase command must have a positive integer.")
        elif action == "replace":
            if not isinstance(command[1], str) or not command[2]:
                raise ValueError("Replace command must have non-empty old and new strings.")
            if command[1] not in buffer:
                raise ValueError("Replace command old text not found in buffer.")
        elif action == "undo":
            if not isinstance(command[1], int) or command[1] <= 0:
                raise ValueError("Undo command must have a positive integer.")
        elif action == "redo":
            if not isinstance(command[1], int) or command[1] <= 0:
                raise ValueError("Redo command must have a positive integer.")

    for command in commands:
        validate_command(command)
        action = command[0]
        if action == "type":
            past.append(buffer)
            buffer += command[1]
        elif action == "erase":
            past.append(buffer)
            buffer = buffer[: len(buffer) - command[1]]
        elif action == "replace":
            past.append(buffer)
            buffer = buffer.replace(command[1], command[2], 1)
        elif action == "undo":
            for _ in range(min(command[1], len(past))):
                future.append(buffer)
                buffer = past.pop()
        elif action == "redo":
            for _ in range(min(command[1], len(future))):
                past.append(buffer)
                buffer = future.pop()

    return buffer
```