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

def replay_notepad(commands: list) -> str:
    buffer = ""
    past = []
    future = []
    for command in commands:
        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.")
            past.append(buffer)
            buffer += command[1]
        elif action == "erase":
            if not isinstance(command[1], int) or command[1] <= 0:
                raise ValueError("Erase count must be a positive integer.")
            past.append(buffer)
            buffer = buffer[: len(buffer) - min(command[1], len(buffer))]
        elif action == "replace":
            if not isinstance(command[1], str) or not command[2]:
                raise ValueError("Replace old and new texts must be non-empty strings.")
            if command[1] not in buffer:
                raise ValueError("Replace old text not found in buffer.")
            past.append(buffer)
            buffer = buffer.replace(command[1], command[2], 1)
        elif action == "undo":
            if not isinstance(command[1], int) or command[1] <= 0:
                raise ValueError("Undo count must be a positive integer.")
            for _ in range(min(command[1], len(past))):
                future.append(buffer)
                buffer = past.pop()
        elif action == "redo":
            if not isinstance(command[1], int) or command[1] <= 0:
                raise ValueError("Redo count must be a positive integer.")
            for _ in range(min(command[1], len(future))):
                past.append(buffer)
                buffer = future.pop()
    return buffer
```